How to Automatically Start a Program on a Flash Drive
Automatically starting a program on a flash drive when you plug it into your computer can be done with an "Autorun.inf" file. The "Autorun.inf" file that you create contains a list of commands which Windows carries out automatically with very little user intervention. While flash drives containing an "Autorun.inf" file can be used to automatically run a program in Windows Vista, XP and older Windows versions, Microsoft disabled the autorun feature in Windows 7 to prevent malware and virus infections through the "Autorun.inf" file.
Instructions
-
-
1
Open the Notepad plain text editor on your computer.
-
2
Type the following command in the first line of the Notepad program to designate the file as an autorun file:
[Autorun]
Press "Enter" to start a new line.
-
-
3
Type the "Open=" command followed by the name of an executable (.exe) file you want to automatically run when your flash drive is plugged into the computer. For example, type the following line to open and start an executable file named "Player.exe":
Open=Player.exe
Press "Enter" to start a new line.
-
4
Type "Action=" command followed by the text you want placed in the AutoPlay dialog box when Windows runs the program. For example, type the following line:
Action=Start Player
Press "Enter" to start a new line.
-
5
Type the "Icon=" command followed by the name of an icon file if you want to specify a particular icon you want shown for your flash drive. The icon can be in "ico," "dll," "bmp" or "exe" format. For example, type the following line:
Icon=Player.ico
Press "Enter" to start a new line.
-
6
Type the "Label=" command followed by text if you want a label for your flash drive to be shown next to its icon. For example, type the following line to name your flash drive:
Label=My FlashDrive
-
7
Review the autorun file commands. The text entered in Notepad should look like the following:
[Autorun]
Open=Player.exe
Action=Start Player
Icon=Player.ico
Label=My FlashDrive
-
8
Insert your flash drive into an available USB port on the computer.
-
9
Click the "File" menu in Notepad and click "Save as." In the "Save in" box, select the letter of your flash drive. Type "Autorun.inf" in the "File name" box. Click "Save"
-
10
Transfer the executable file and icon file you specified in the "Autorun.inf" file in the root directory of your flash drive if you have not already done so. In other words, transfer the "exe" and/or icon files to the outermost layer of your flash drive, not inside any folder or sub-folder.
-
11
Remove the flash drive from your computer. Insert the flash drive into any computer's USB drive to start the program that you specified in the "Autorun" file automatically.
-
1