Start Programs Automatically With USB Agent - gHacks Tech News

Start Programs Automatically With USB Agent

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.

Summary
software image
Author Rating
1star1star1star1stargray
no rating based on 0 votes
Software Name
USB Agent
Operating System
Windows
Software Category
Productivity
Landing Page




  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. ilev said on December 11, 2009 at 8:37 pm
      Reply

      Microsoft sees autoplay as a security risk and disabled the feature in Windows 7 as well as updated XP and Vista do disable it.

    2. Cornflower said on December 18, 2009 at 4:47 pm
      Reply

      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.

    3. marc said on May 14, 2010 at 12:12 pm
      Reply

      I downloaded this and am trying to get it to run a program when i insert the stick into my laptop, running 7. I cant work out the %basepath% syntax, can someone post an example of how it should be written to run example.exe in C:program files please?

    Leave a Reply