« Free keylogger protection?How to get over the 4GB limit on FAT32 »

Autorun tool for removable USB flash drives

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=PD\PrvDisk.exe /minimize /path:image.dpd /symbol:Z /RD
ACTION=Mount Private Disk


  • ICON is an optional parameter, and it can be removed
  • 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.

Tags: tips, usb, windows
PermalinkPermalinkCategories: Support highlights


Comment from: Gary Smith [Visitor] Email
Gary SmithVery interesting Alex.
Just what I was looking for.
I am looking forward to trying it on an application I am developing.

2007-03-10 @ 23:09
Comment from: Gary Smith [Visitor] Email
Gary SmithHi Alex,

I placed the Runme.exe and autorun.inf files on my Thumb drive.

I did get the "Removable Disk (E:)" window with the Runme Icon, which was exciting!

But when I clicked on "Mount Private Disk", It gave an error message:

E:\ Access is Denied

2007-03-27 @ 13:32
Comment from: Alex [Member]
AlexCan you post the contents of your autorun.inf file here? Taking a look at the paths will give me an idea about what goes wrong.
2007-03-27 @ 14:26
Comment from: PEJOL [Visitor] Email
PEJOLE:\ Access is Denied

Try to visit http://infoklik.blogspot.com

it works well for me.
2007-04-06 @ 04:06
Comment from: Sean [Visitor] Email
SeanHow can I create and use a custom icon instead of the default RunMe.exe icon (compass)?
2007-05-08 @ 14:13
Comment from: Rudy [Visitor] Email

Will this feature work on Mac systems?

Are there any restrictions on using RunMe commercially integrated into some software I am developing to be sold.
2007-05-19 @ 17:44
Comment from: Alex [Member]
AlexPEJOL, '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
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.
2007-05-21 @ 03:25
Comment from: Lauren [Visitor] Email
LaurenWill this work in Windows Vista?
2007-05-22 @ 14:37
Comment from: Dataloss [Visitor] Email
DatalossI'm looking for a piece of software that can actually open the application without going through the hassle of a menu. If you know of such a program, email me at pikachu6517855@gmail.com
2007-05-22 @ 16:15
Comment from: Aamir [Visitor] Email

Exactly what i was looking for
Works fine

2007-07-26 @ 13:27
Comment from: Wayne [Visitor]
WayneThis 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?
2007-09-12 @ 05:47
Comment from: abdo [Visitor] Email
abdoThis is not working. How can you get runme.exe to run. It is not clear. I have tried it but does not work.
Am I missing somthing.


2007-10-23 @ 02:47
Comment from: Alex [Member]
AlexAbdo, it means that autorun is disabled, and you'll have to enable it. Try this:

  • Start regedit,
  • go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom
  • Set 'AutoRun' to 1
  • restart the system
2007-10-25 @ 02:22
Comment from: Anke [Visitor] Email
AnkeThere is a small utility that will enable the usb stick to autorun WITHOUT having to go through the menu. It's called DeskMount, and you can find it here:

I've been using this one for a year, and it works great! It also works on Vista and XP SP1 by the way...
2007-10-31 @ 13:21
Comment from: Alex [Member]
AlexLooks 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.
2007-11-01 @ 02:33
Comment from: Avram [Visitor]
AvramThis works fine, but M$ should enable ordinary autorun for USB drives by default
2007-11-22 @ 09:37
Comment from: Peter [Visitor] Email
PeterI'm trying my best, but nothing happens after I plug USB stick...

Here is my autorun.inf:
OPEN=starttc.exe /minimize

It is expected to run starttc,exe

I monitored system, but RunMe.exe was not touched at all...

2007-11-25 @ 14:39
Comment from: amigo [Visitor] Email
amigoNice article.Thanks, all problems are solved
2007-12-04 @ 20:24
Comment from: Alexander [Visitor]
AlexanderPeter, 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).
2007-12-05 @ 03:03
Comment from: Rae [Visitor]
RaeWhat? 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?
2008-02-27 @ 19:43
Comment from: Alex [Member]
AlexRae, 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.

In the end you'll have something like:

OPEN=PDFReader.exe MyDocument.pdf

2008-02-27 @ 20:40
Comment from: Lewis Carey [Visitor]
Lewis CareyI 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!
2008-03-06 @ 12:50
Comment from: Adrian Langlouis [Visitor] Email
Adrian LanglouisIt works, however, I have the same problem as indicated further up: I cannot select the "always do the selected action" flag in the popup..
2008-04-08 @ 19:07
Comment from: Gregory Scales [Visitor] Email
Gregory ScalesHi Alex,

I placed the Runme.exe and autorun.inf files on my Thumb drive.

I did get the "Removable Disk (E:)" window with the Runme Icon, which was exciting!

But when I clicked on "Mount Private Disk", It gave an error message:

E:\ Access is Denied

This is the autorun file I used:

OPEN=PD\PrvDisk.exe /minimize /path:image.dpd /symbol:Z /RD
ACTION=Mount Private Disk
2008-05-20 @ 19:13
Comment from: Alex [Member]
AlexThe program is caused by the fact that Windows does not allow files from sub-directories to be started if certain security settings are enabled.

In this case you will have to start RunMe manually, and it will take the parameters from autorun.inf and launch the specified program for you.

An alternative is to place the EXE you want to run in the root directory.
2008-05-26 @ 11:57
Comment from: Venturer [Visitor]
VenturerThe program RunMe.exe has a bug.
If no command line parameters are specified it quits without and error message and without running the target program. I had to specify a dummy argument.

I need autorun for the icon, not commands.
2008-07-31 @ 17:44
Comment from: Alex Railean [Visitor]
Alex RaileanHmm, that should not be the case; all errors will indeed be silently ignored, but if you give it a EXE name it will run it even if there are no other arguments.

Have you tried it with another EXE?
Can you tell me what's written in your autorun file? I could simulate the issue here and see what is happening.
2008-08-01 @ 11:36
Comment from: George Barrowcliff [Visitor] Email
George BarrowcliffI 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
and the executable is Minnie.exe of course.

2008-08-04 @ 01:59
Comment from: Alex Railean [Visitor]
Alex RaileanGeorge, I'm afraid I don't have good news for you. I've seen such disks; this behaviour is hardcoded into them.

Maybe you can disable autorun and solve the problem 'the hard way'?
2008-08-04 @ 09:38
Comment from: Rhys [Visitor]
RhysGot it to work with

OPEN=PrvDisk.exe /minimize /path:ENCRYPTED.dpd /symbol:Z /RD
ACTION=Mount Private Disk
2008-10-30 @ 19:29
Comment from: Richard [Visitor]
RichardI have put both RunMe.exe and below autorun.inf file in the root of the USB flash drive, also enable autorun in the system but nothing happens when I plug the USB flash drive, please help.

OPEN=PD\PrvDisk.exe /minimize /path:image.dpd /symbol:Z /RD
ACTION=Mount Private Disk

Thank you
2008-11-09 @ 04:36
Comment from: sergo [Visitor]
sergoHi all.
warning, here the virus

sorry,but no work device...
2008-11-30 @ 12:47
Comment from: umesh [Visitor]
umeshmy usb flash disk with 1GB is not open
with autopaly option in winxp

so what is prob and pls give me proper
solution to open my usb flashdisk with
auto play option..
2008-12-11 @ 11:31
Comment from: umeshpatel [Visitor]
umeshpatelI 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..
2008-12-11 @ 11:34
Comment from: louis [Visitor]
louiswhat the fusk is PD\PrvDisk.exe ?? on open parameter??, im not able to autorun a usb flash drive with this post
2009-03-03 @ 20:19
Comment from: Rodney [Visitor] Email
RodneyPlease help...deadline approaching.

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
2009-07-22 @ 23:06
Comment from: Alex [Member]
AlexRodney, post the contents of your autorun.inf here. But until then, I assume you wrote


It won't work, because "open" is only for programs. Instead try this:


Letme know how things went.
2009-07-23 @ 17:31
Comment from: Rodney [Visitor] Email
RodneyHey Alex, it worked like a charm once I used your code. I just wish I would have posted a couple of days ago and saved myself some stress. Thanks again for your help and everyone else on this thread.
2009-07-23 @ 20:00
Comment from: Kermonk [Visitor]
KermonkSo this works for flashdrives? Sure as hell doesn't work for usb sticks
2009-07-31 @ 02:53
Comment from: chris [Visitor]
chrisComment from: Kermonk [Visitor]
So this works for flashdrives? Sure as hell doesn't work for usb sticks
2009-07-31 @ 02:53

wow.. flash drives and usb sticks are the same thing. really..
2009-11-03 @ 17:02
Comment from: vivek [Visitor]
viveki want to tranfer some maya files with .mb extension to d drive of my computer as i open the usb drive
2010-03-04 @ 16:47
Comment from: Blake [Visitor] Email
BlakeI cannot get batch files to launch using the autorun file. my code that i used: [autorun] ShellExecute=command.exe ICON=RunMe.exe ACTION=Open Command Prompt after clicking the option "open command prompt" when loading flash drive it says- "windows cannot find "command.exe"" i dont know why it wont load batch files. can u help me?
2010-04-15 @ 14:55
Comment from: Alex [Member]
AlexBlake, try using "OPEN" instead of "ShellExecute" in your inf file.

The former is for starting programs, the latter is for opening files (ex: html pages)
2010-04-15 @ 15:04
Comment from: Blake [Visitor] Email
BlakeWhen i do the "OPEN" instead, it just brings up a window that says "Open With". which doesnt actually execute my batch file
2010-04-15 @ 15:23
Comment from: Alex [Member]
AlexHmm... I don't see any reference to the .BAT file in your example.

Can you double-check? Also, when you post it, use the code tag.

Just in case, if you want to rub a BAT file inside from within a BAT file, you don't just type the name of the second BAT, instead you write

call second.bat
2010-04-15 @ 15:40
Comment from: mobile phone [Visitor]
mobile phoneI'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.

So I'll bookmark this for later and try it out
2010-06-28 @ 19:20
Comment from: jill [Visitor]
jillthe 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?
2010-10-07 @ 06:55
Comment from: Alex [Member]
AlexHi Jill!

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.
2010-10-07 @ 12:00
Comment from: promo usb [Visitor]
promo usbThanks 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.
2011-01-12 @ 18:50
Comment from: Lori [Visitor]
LoriI 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
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.
2011-03-04 @ 19:50
Comment from: Alex [Member]
AlexLori, which version of Windows is this happening on?
2011-03-05 @ 01:59
Comment from: Ford [Visitor] Email
FordHi 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

Thanks. Deadline 24hrs from now. Pls help.
2011-04-08 @ 12:07
Comment from: Alex [Member]
AlexHi Ford, I'm sorry but I did not notice your comment earlier. I think that the most simple solution will be this one:

  • use a portable version of VLC

  • configure autorun to stat vlc.exe with the path to the video you want to play

VLC can play practically anything - so it is certainly the best solution I can think of, off the top of my head.
2011-04-19 @ 17:31
Comment from: DLB [Visitor]
DLBHi Alex,

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:




Could you please help me?
2011-08-16 @ 16:06
Comment from: Alex [Member]
AlexDLB, my guess is that Windows doesn't like the long file name. Try to make it fit into the 8.3 format (i.e. 8 characters for the file name and 3 for the extension), ex: test.png or wallp.png
2011-09-06 @ 16:55
Comment from: Donald [Visitor] Email
DonaldPlease 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.


I want a wwww.pps file to also autorun immediately it is inserted.

Thank you ALL.

2011-12-09 @ 10:06
Comment from: Alex [Member]
AlexHi Donald,

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
2011-12-22 @ 11:18
Comment from: Alberto [Visitor]
AlbertoAlex, 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 ?
2012-02-15 @ 15:12

This post has 2251 feedbacks awaiting moderation...