Autorun / Autoplay for USB devices

I use a password manager program on a USB pen drive since I want to use different user credentials for my accounts, but I have a very bad memory so I can not remember them all. Additional this approach makes it possible that I have always access to my password safe no matter where or on which machine I work. Furthermore it can be considered more secure to save these sensible information on a separated device which is only connected to the computer when actually needed.

However, it is very annoying to have to plug the USB stick in, navigate to the executable of the password manager and start it manually. That is the reason why I wanted an Autorun or Autoplay solution, so that I only have to plug the USB device in and the password manager will start automatically.
 

If you find a mistake or have suggestions for improvement feel free to contact me.



The solution

Create an autorun.inf file and put it into the root directory of the USB pen drive. The following sample will do the job. The entry for the icon can either point to a ICO icon file or an executable which offers a build in icon. The open and shellexecute entry should point to the executable which should be started when the USB pen drive is plugged in. 
    [autorun]
    icon=WinDietrich.exe
    action="start Password-Manager"
    open="passwordmanager.jar"
    shellexecute="passwordmanager.jar"
    label="Alti's Key USB-Stick"

With this file in place the next time you plug the USB drive in a Autorun dialog similar to this should appear.

Also the entries in a normal explorer window should now use the settings from our autorun.inf file and therefore look something like this:

Notice the label and the Icon of the tree entry of the USB device.



Useful links and references

Autorun USB third party software - Freeware
Microsoft MSDN Autorun INF entries
How to enable and configure Autorun

 

last updated 02 November 2008