July 28, 2008

Making your USB thumb drive Autorun

Let's say that you've got an application that's more or less self-contained. You've installed it onto your USB thumb drive and you'd like for it to autostart when you plug in the USb drive. Here's what you do:

1) Copy/install the application(s) that you want onto the thumb drive

2) Using Notepad (or text editor of your choice), create, in the root of your thumb drive, an Autorun.inf file and add the following lines:

[Autorun] Open=\applicationpath\application.exe relative path to application you want to start, since the drive letter will change from PC to PC

note: technically, you could stop here; this will work as is.

Action=Start whateveryouwanttocallit this displays a menu name when Windows pops up the choices (open folder in Explorer, run application, play media files, etc.)
Icon=whateverimageorfileiconyouwantouse displays the icon to for the app
Label=AppLabel needs no description

You're probably wondering how you can prevent someone from canceling out of the Windows pop-up choices for "what do you want to do?" with your thumb drive, as well as preventing someone from being able to double-click on the thumb drive to explore/wreck its contents. Simply add the following line to the ones listed above and, when someone double-clicks on the thumb drive letter, the application will autostart:

shell\open\command=\applicationpath\application.exe

There you have it. Now go forth and be geeky.

Posted by Physics Geek at July 28, 2008 05:49 PM | TrackBack StumbleUpon Toolbar Stumble It!
Comments