Portable apps—self-contained executables that can be moved onto flash drives and run without installation—are popular tools for anyone who has to work on multiple Windows machines. If you want to make your workflow even faster, you can add an “auto-run” file that automatically opens the program as soon as you plug in the drive.
RELATED: What Is a "Portable" App, and Why Does It Matter?
Unfortunately, starting with Windows 7, Microsoft restricted the autorun function for security purposes. There’s no practical way to get it back on every new machine, but it’s possible to do so on computers you have access to on a regular basis. First, you’ll need a small, third-party tool that monitors new USB drives for the autorun instruction. Then, you’ll need to create a simple autorun script file that sits on the USB drive and designates what program to run when you insert the drive.
Step One: Install APO USB Autorun on Your Windows PC
APO USB Autorun is a program that monitors USB drives as they’re plugged in, looking for the legacy autorun.inf script file and launching any programs directed within. Download it from Softpedia here, then double-click the installer file and install it like any other program.
After installation, whenever you connect a USB drive, you should see a window pop-up like the one below, asking if you want to run the program you’ve designated to run automatically (and we’ll talk more about how to do that part in a bit).
Just click the “Run” button to run the program and, optionally, disable the “Always ask before opening this file” option so that you aren’t bothered with this warning the next time you insert the drive.
Unfortunately, you’ll need to install APO USB Autorun on each Windows 7 or later PC that you want to autorun your USB drives. That makes it not so useful for drives you carry around to lots of different PCs, but it can be really helpful if you often work on the same computer.
Step Two: Set Up the USB Drive
In order to autorun a program, the USB drive needs to contain two things: the program you want to run and an autorun script file that points to that program.
Go ahead and copy the portable executable for the program to your USB drive. That’s the easy part.
To create the autorun script file, open up Notepad (or whatever text editor you prefer). Type (or copy and paste) the following text into the Notepad window, complete with line breaks.
[autorun] ;Open=YOURAPP.exe ShellExecute=YOURAPP.exe UseAutoPlay=1
Replace the “YOURAPP” text with the file name of the application you’re trying to start. I’m using the portable version of the Lynx browser for this demonstration, so my commands read like this:
[autorun] ;Open=LynxPortable.exe ShellExecute=LynxPortable.exe UseAutoPlay=1
Next, save the file to your USB drive with the name “autorun.inf” and make sure that you select “All Files (*.*)” in the “Save as type” field. That way, Notepad won’t add an additional “.txt” extension to the end of your file name.
The root folder of your USB drive should now contain the program’s executable file and the autorun.inf file you just created.
You can place other files and folders in the drive, of course, but make sure to keep those two items in the root directory.
Now, with APO USB Autorun running and your USB drive properly configured, your program should run automatically whenever you connect the USB drive to your PC.
Image credit: Amazon