It sometimes can be quite handy to start programs automatically when a new USB storage device is connected to the computer system. This can be an USB flash key or external hard drive. Applications that come to mind are automatic virus scans of the data on the drives or the start of True Crypt or another data encryption program if data on the USB storage device is encrypted.
USB Agent is a portable software program that provides this functionality. It requires some manual preparation before it will execute the programs. This should not take longer than a few minutes the most though. The most important step in the process is the creation of a new file on the USB device that has to be named usbagent.inf. The following information need to be added to the file after its creation (with a text editor):
[usbagent]
ON=start-app.exe
OFF=stop-app.exe
where start-app.exe and stop-app.exe need to be replaced with executables or batch files that the user wants to execute if the USB device is connected and disconnected. The executables and batch files can be stored on the USB device by using the format
ON=%basepath%\start-app.exe
where %basepath%\ is pointing to the root folder of the USB device.

USB Agent comes with an option to mount True Crypt containers that are stored on USB devices. This can be a handy option to automate the mounting of the encrypted container. The portable software is available at the developer’s German website. A link to Google Translate is listed at the top of the page to translate the page into a different language. The program itself is available in English and German and compatible with Windows 2000 and newer Microsoft operating system including Windows 7 and Windows Server 2008.
Related posts:
- Optimize Windows Startup Programs With Start-Q
- Control which Programs start for Beginners
- Get rid of a huge programs list in the start menu
- BitLocker To Go Reader
- Change Default Programs Temporarily With Coffee
- Automatically order your Windows XP Start menu alphabetically
- Start Multiple Applications from the Start Menu
- Start Program after Idle Time

Microsoft sees autoplay as a security risk and disabled the feature in Windows 7 as well as updated XP and Vista do disable it.
I downloaded this the other day when they disabled autoruns at my office, and it works great as it runs known programs from known USBs.
I have found two things that may result in a single suggestion:
1. I have a Read-only stick that after logging onto its encryption opens the read-write portion. I cannot generate usbagent.inf on this stick.
2. There is an insecurity in that someone can place a usbagent.inf file on the USB to run malware. The issue here is that the name of the file is constant.
Suggestion (once I learn Germant o suggest it) that usbagent have an option to run usbagent.inf from the host computer, so that it can decide what file to call from the usb drive., anming it as one will.