Posted by & filed under Developer Blog.

This solution doesn’t create an actuall Autorun, but it does allow you to specify an app you want to run when double clicked from My Computer using the AUTORUN.INF

First I turned off all XP Autorun for my USB drive by right clicking the drive in My Computer folder, selecting the Autorun tab, then selecting each media type individually and selecting the “take no action” option.

Next I created a file called AUTORUN.INF and set it to be a hidden file. I placed that hidden file on the root of my USB drive. Then I opened the AUTORUN.INF file in notepad and entered the following:

[autorun]
shellAuto=&Autoplay
shellAutocommand=appspstartPStart.exe
ICON=appspstartPStart.exe
 
shell=Auto
label=My USB Drive

Where appspstartPStart.exe is the application to run when double clicked in My Computer.