Home > General > Messing with autorun.inf

Messing with autorun.inf

January 4th, 2009 Leave a comment Go to comments

Like most of you, I have a USB key that I store some of my portable stuff on (quite useful if you move computers – say from home to work).  I’ve found it extremely invaluable, especially when combined with PStart and RoboForm2Go.  To make my life even easier, I whipped up an autorun.inf file for my USB key that would load up PStart for me when I plugged it in to the computer (well, close to it – it initiates Windows Vista’s AutoPlay feature which shows me a “Load Start Menu” action which I click to run PStart).

However, there was one very big problem that I encountered early on – the “shellexecute” and “shell\verb\command” actions did not work very well when there were spaces in the path names.  Now, most of you would say, “well, did you quote the path names in double quotes?” – the answer is yes, I tried that.  In fact, I tried all sorts of things and found that the only way I could get it to work was by using double quotes and having to specify the drive letter.  That sucked – that meant that my portable USB key was no longer really portable, since if the drive letter wasn’t what was in my autorun.inf file, it wouldn’t run (or worse, run the wrong program).  So that solution wasn’t acceptable – I had to find a solution.

Well, after a bit of searching, I did come up with something… I decided to use the old MS-DOS 8.3 filenames to specify the path (the USB key was formatted with FAT32).  This worked for me and all was well – so long as the short filenames didn’t change, everything was fine.  However, I recently went out and got a new USB key (a nice super small one – pretty awesome) and noticed that Windows Vista supported a filesystem called exFAT, which is apparently the next filesystem after FAT32 and supposedly works quite well on portable devices (less overhead, less fragmentation, etc…).  So I formatted my new USB key using exFAT and copied all my data from my old USB key to the new one and figured it would just work as the old one did – wrong.

As it turns out, exFAT is actually pretty good… it even dropped the old short filename thing and now uses only long filenames.  Oh, yeah, damn… I was using short filenames in my autorun.inf.  Now I was really screwed – the one fix that I found worked for me was now out the door.  I need a new fix (I really wanted to try exFAT)!  So, I began searching again and to my disbelief, I finally found someone who had figured it out and posted about it (thankfully)!

The post I found was over at Wercshop, and the solution to the problem is to use two sets of double quotation marks.  I don’t really know why, and I really don’t know why this isn’t documented anywhere on MSDN that I could find – in fact, almost everyone seems to just ignore this issue (and one website said to rename your files and use underscores instead of spaces).

For those interested, here is the autorun.inf I use on my USB key:


[AutoRun]
UseAutoPlay=1
includeRuntimeComponents=True

action=”Load Start Menu”
label=”USB Portable Apps”

open=”Program Files\Start Menu\PStart.exe”
;icon=”Program Files\Start Menu\USB Stick.ico”

shellexecute=”"Program Files\Start Menu\PStart.exe”"

shell=load
shell\load=”Load Start Menu”
shell\load\command=”"Program Files\Start Menu\PStart.exe”"

[Content]
MusicFiles=0
VideoFiles=0
PictureFiles=0

  1. No comments yet.
  1. No trackbacks yet.