Start Programs Automatically With USB Agent

0
126

USB Agent is a free portable program for Microsoft Windows devices to run automatic actions when USB devices are plugged in or removed.

It sometimes can be quite handy to start programs automatically when a USB storage device is connected to the computer system. This can be an USB flash drive or external hard drive for example.

Applications that come to mind are those that run automatic virus scans of the data on the drive, start True Crypt or another data encryption program if data on the USB storage device is encrypted, or programs to create automatic backups of the data stored on the device.

USB Agent

usb agent

USB Agent is a portable software program that provides this functionality. It requires some manual preparation before it will execute the a program though, but this should not take longer than a few minutes most of the time.

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 executable or batch files that the user wants to execute if the USB device is connected and disconnected. The executable 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.

Other options that it makes available are to eject all on exit, show removal messages, or run applications on exit.

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, 8 and 10, and Windows Server versions.

Closing Words

USB Agent is a useful program if you work regularly with USB devices and want certain actions to be executed whenever you connect on of these devices to a machine running Windows. The program has not been updated in a while, which you see most clearly in its support for TrueCrypt — a program that is no longer maintained — but it works just fine in newer versions of Windows.

While it is a bit of a hassle to configure the program, considering that you need to create the file manually on each USB device, it may help you save time and avoid forgetting certain processes that you want carried out whenever a USB device is connected to a computer.