Autorun tool for removable USB flash drives

If you have a USB flash drive, then it is very likely that at some point in time you were interested in adding an autorun option, so that a program would start whenever the flash drive is plugged in. After several experiments, you probably concluded that it's not going to work, especially if you've read Microsoft's FAQ for driver developers.

The interesting fact is that somehow I actually managed to make it work. I haven't yet determined the key-factor which decides whether USB autorun will work or not, but the good old autorun.inf in the root directory approach still works. Apparently, USB autorun is allowed in XP SP2 (so SP2 is the key-factor), but I am not sure about that one yet.

So how does it work?
- create a blank autorun.inf in the root directory of the thumbdrive
- edit it with a text editor, the contents should be:

OPEN should not be tied to any paths, use relative paths if you want to make sure that USB autorun will work correctly on computers that have a different number of drives and drive letters

ACTION can be customized, you can use any text

What is RunMe.exe you ask? In this case it is the EXE file the icon of which is used to represent the thumbdrive in the list of drives in My Computers. You can use an .ICO file for such purposes too.

However, RunMe.exe has another (more important) role. If autorun is disabled on a specific computer, you will not see the autorun menu when the thumbdrive is plugged in, hence the application will not start automatically. In that case you will be forced to explore the drive and run the program manually. But what if you need to launch the program with specific command line parameters? Open a console window and type the parameters there? Or use a .BAT script to do the same task?

The problem with BAT files is that you'll see a DOS window once the target application was launched, this window will have to be closed manually - and that takes time, and will soon become a very annoying procedure. RunMe solves this task by processing the autorun.inf file and running the program indicated in the OPEN section, along with its command line parameters [if any]. This will spare you from the tedious task of closing a console window (inexperienced users might not do that, being afraid of the consequences of an action they don't understand).

If autorun.inf is missing, or it contains invalid parameters (for instance - the path is invalid), the program will silently quit, without throwing any obscure error messages which can scare the hell out of newbies.
Follow this link to download RunMe USB autorun.

PEJOL, 'access denied' will not occur when you attempt to start a file from the root directory of the drive; it will show up if you attempt to launch a file located inside a directory, or on another partition.

Sean, the icon can be changed by editing

ICON=RunMe.exe

Instead of RunMe.exe write the name of your ICO file, or the EXE file the icon of which you intend to use. Note that the icon of RunMe.exe cannot be changed (unless you recompile the program if you have its source code)

Rudy, unfortunately I think it will not work, because Macs have a different type of executable files. Moreover, they probably have a different approach to autorun on removable drives. I am not familiar with this platform so I cannot provide constructive feedback.

This is GREAT! I've been able to get the action loaded into the pop up window on XP SP2 and get the icon showing up too. I notice now that the little check/tick box at the bottom of that window that says 'always perform this action' is gone. Is there a way to specify in the autorun file to always do it?

Looks like it can do the trick, but the problem with this tool is that it has to be installed on the computer. The probability that it is installed on another computer you intend to connect your USB disk to is extremely small.

Peter, Runme.exe is not supposed to be touched, according to your config.

It seems that autorun is disabled on your system, so you need to enable it, to do that, see the message from Alex, 2007-10-25 @ 02:22

The role of RunMe.exe is to do the job of the autorun.inf file if autorun is disabled - if that's so, simply click RunMe.exe and it will perform all the actions specified in the autorun.inf (this is the best you can do).

What? How does this work? I'm an admin asst. with no tech experience and I think I get some of it but, its not working. I'm trying to run a pdf file and all of the literature I've found so far says anything you use has to end in .exe or .ico...I'm so confused! Can you offer help?

Rae, you'll have to take care of several things. First of all, you can't be certain that there is a PDF reader on the target system, therefore you'll need to place such a program on the USB disk as well. Try something like Sumatra PDF, as far as I know, it requires no installation and can be ran directly from a removable disk.

Second, see if the PDF reader supports command line parameters, and how they work.

I was unable to get this to work but have since discovered an alternate solution.
I downloaded mypendrive http://www.download.com/MyPendrive/3000-2094_4-10589782.html?tag=lst-3
and combined this with an autorun exe program at http://www.teapot.orcon.net.nz/autorun/autorunmaker.html
These combined allowed me to autorun a powerpoint from a flash drive...at last!

I have a flash drive that mounts as a 100 mb cd and a 900 mb removable drive.
The cd partition has an autorun and an executable. When the drive is plugged in, the autorun runs the executable.
Since the os treats the cd as read only files they cannot be deleted and I have been unable to delete the cd partition from the flash drive.
Every time this drive is plugged in, I get a full screen flash file of Minnie mouse throwing hearts around the screen. My coworkers love it.

How can I remove the cd partition from the drive?

Autorun.inf says
[autorun]
open=MINNIE.exe
and the executable is Minnie.exe of course.

I have usb flash disk and it still not
play with autorun option.while my other
friend flash disk also open in my pc with
autorun option..so could u tell me what is
prob,and pls give me suggestion so solve
this prob..

I have spent 2 days trying to figure out how to get a website to auto run from my flash drive (marketing tool) and I just cant get it to work. Maybe someone here and advise me. I'm trying to run a html file called "1_results.html" which should open once drive is inserted. Where would I insert my html file in this code? Also my code is in the root of the drive.
Thank you - Rodney

I'm bookmarking this. I definately have had some interest in doing something like this with both my flash drive, and other CDs. I've been wanting to do this for my art portfolio, so it loads my portfolio up immediately.

the 4 gig flashdrive i bought has autorun and occupied 880MB that almost ate 1 gig so i have only 2.85 gig.i want to uninstall the autorun but i can't do it. is it possible to uninstall the autorun in my flashdrive? what is really the benefit of autorun in flashdrive?

The easiest thing to do is to simply format the flash disk, this will erase its contents and free up all its storage capacity.

Alternatively, you can select the existing files and delete them, like any other file.

The benefit of having autorun is that when the disk is plugged in, a program from it will start automatically.
It is nothing extraordinary; if autorun didn't exist - you would just have to do a couple of clicks.

Note that a system can be configured to prohibit autorun (it is safer from the security point of view - so many people go for it), this protects it from a virus that could be ran automatically when a removable disk is plugged in.

If deleting the autorun files or formatting the disk doesn't work - let me know and we'll figure something out.

It is a pretty strange case - I've never seen a vendor that fills their flash disks with 800 MB of useless data.

Thanks for the advice, I had a file which was within the 2gb limit of my usb stick but due to the autorun, it couldn't fit. After deleting it I was able to squeeze it on. Thanks again for the help, I was about to go out and buy another usb stick until I came across this post.

I am also trying to get a USB key to autorun an .html file. I have copied the runme.exe onto my key and have this autorun.ini
[autorun]
LABEL=CompanyName
ShellExecute=index.html
ICON=RunMe.exe
ACTION=Mount Private Disk

When I insert the key it just pops up the standard window you get when you put a usb drive in, instead of launching the index.html?? Help please.

Hi Alex. Got serious trouble. Been trying to
get a flash drive of 2GB to autorun a video
automatically as soon as it is plugged into
a PC. The Problem:
1. What appropriate format should the videos
be in? Someone suggested H.264
2. What autorun.ini should I use to autorun
automatically?

I have been trying to use this autorun method, but the only part that seems to work for me is the label. Nothing else seems to happen other than the standard window of options popping up. I am running Windows XP. I have tried both:

Please can someone help me, I dont understand all that has been written, could someone help me with my own exact code.
I want to make a *.pps (powerpoint show) file autorun, with it is also an icon and label too.
I have achieved only 2, which is icon and label with this code.

You need to keep in mind that the PowerPoint file requires one to have PowerPoint on their computer, otherwise nothing will happen.

So, the solution to the problem is to find a "portable powerpoint viewer", that is a self-contained program that runs directly from a USB disk and doesn't require a local installation.

You would then have to make your autorun file run that program instead, and use a command line argument to "tell" it which presentation to open.

Do you really need Powerpoint? If PDF will do, then you may want to have a look at SumatraPDF - it is free and a portable version is available too: http://blog.kowalczyk.info/software/sumatrapdf/download-free-pdf-viewer.html

Alex, I've downloaded you RunMe.zip version and wont work, neither if I execute manually the RunMe.exe file nothing happends... (so I don't know what is that exe for ??)
Obviously I've the CDROM autorun activated in the registry, I only get work change the icon of my pen drive, but never autoexecute a file... (obviously too, I've tried with my own app, that only opens a 'Hello Word' message) Allways I get the message of the autoplay when I insert my pen drive in the PC.
Ideas ?