Do you want that a certain program should run when you insert your USB flash drive? Or do you want to add a custom icon for your flash drive? If the answer to any of the question is yes, then you have come to the right place.
It is possible to auto run the programs and applications from your removable USB flash drive like the autorun feature in CD/DVD drives. The autorun.inf file is the key to getting your USB drive to perform certain actions automatically and customize it’s look in My Computer. The purpose of this article is to shed some light on how this can be done.
Note: Autorun feature does not work in Windows 7 any more, Microsoft has disabled it due to security reasons. But this feature works fine in Windows Vista, Windows XP, and older OS.
Basic Autorun.inf Structure
The autorun.inf file is a simple text file that can be opened up in any text editor (e.g. notepad). It always starts with a section header of:
Below this header is a list of different options. Each of these options is in the following format:
Setting Up AutoPlay Options
Autoplay allows you to set up what file is run when the USB drive is plugged into the computer. There are two options that work in concurrence with AutoPlay. The first is
open which specifies the program that you can run automatically with AutoPlay. So, if we wanted to run a program called MyProgram.exe, you would add the this to your autorun.inf file:
The second option that we add is the message the user is prompted with. To set this, we use the
action=MyProgram Open Program
When your autorun file is done, save it as autorun.inf. Once the autorun.inf file is saved, the flash drive autoplay will look something like this:
Customize USB Flash Drive’s Icon
To create a custom icon for your USB drive, use the
icon option. Set it to the name of the icon file.
For example, if you had an icon on the root of the USB drive called sun.ico and you wanted this to be the icon that showed up for the USB drive, you would enter:
You can also use some other application’s icon by specifying
This is valid as long as Photo.exe is available on the root of the USB drive.
Label Your Flash Drive
If you want your USB drive to display a specific name other than the drive label created when it was formatted, then use the
label option. For example, if I wanted to call my drive Asad Drive, I would add this to my autorun.inf file:
Now, when you look at your USB drive in My Computer, it will say Asad Drive by the drive letter.
Autorun Files or Web Addresses
If you wanted to view a file on your USB drive in the default application instead of running a program on the drive, you can substitute the
open option for the
shellexecute option. For e.g
if you wanted to open up a website www.google.com in the default web browser, you could use the following:
Now start customizing your USB drive now. Don’t forget to leave a comment. 🙂