1. Home
  2. Hardware

How To Autorun Programs From USB Flash Drive And Add Custom Icons

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 option.

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:

label=Asad Drive


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. 🙂

Leave a comment

  • Yasamoka

    Great Tips! Thank You!

  • Check out our other posts for more such tips and tricks ! 🙂

  • You Are Brilliant. Nice Work HEre

  • bob sagget

    Does not work for flash drives in XP, only Vista 🙁

    • DJ Dirty D

      Actually, it does work on XP. I just set one up.

      Thanks for the help!!
      It was much clearer than similar posts.

      • Spencer Hanson

        How??? I need help…. 🙁

  • Arjun

    Is there a way to Run the Presentation(ppt) in full screen, directly when the USB is connected. Without any button clicks.

  • Thushara

    Very usefull and thanks.

  • Blake

    Actually, bob sagget, it does work. I did it myself. Are you sure you typed everything in correctly using NOTEPAD and saved it as “autorun.inf”?

  • Blake

    in Windows XP, I mean. Great article, by the way! 🙂

  • Pingback: Convert Any Video File Into Self-Running Executable (.Exe) Player()

  • THe same thing to CDS.
    icon=ACCM Eagle Icon 2002.ico
    open=ACCM 1.3.2 Beta.exe

  • is this compatible for any OS?

  • Raju Ksh

    hey i love dis explenation,thank u.

  • Pingback: Create And Add Autorun Files To CD/DVD Automatically In Windows()

  • Revan343

    Is there any way to force it to run a program as soon as you plug in the drive, instead of having to click on it to run it? I want to duplicate MouseJiggler, and it would just be that much easier if it started on it’s own.

  • Yaro

    Autorunning software from rewritable removable media. What could POSSIBLY go wrong?

  • Excellent instructions for doing this — thank you very much for explaining it so simply and clearly.

    Take care,

  • wholesaleusbflashdrive

    yeah ,it's great..

  • wholesaleusbflashdrive

    yeah ,it's great..

  • wholesaleusbflashdrive

    yeah ,it's great..

  • oemusb

    yaah,it's great,thanks.

  • Sinner_84

    is there a way u can password prtecet ur drive so it can not be formated so like it has to ask for a password, i havea good usb encrpyer but i can still format the drive is the any way i can stop this?? becase they can erase the drive and use it there self, and is there a way u have have more then one Autorun.inf

  • smar2wo

    But if i want to open an .exe WITHOUT any clicks or confirmation from a pop-up window when i insert my USB stick? what should i do? that text should i write in [autorun]?… just like from a CD (from exemple Nvidia CD drive installation that opens setup.exe).

  • suryakoduri

    very useful thank you so much.

  • manos_in_gr

    very useful thank but not work in vista
    Any sugestion?

  • Red

    I want to auto-run a file, without clicking on anything (I want it to run as soon as I plug in the flash drive). It isn’t “auto”-anything if you have to click on it.
    How would I go about doing this?
    Instructions, links, anything will work.

  • Rashad,Shahzad,Fames654

    if I play background sound so what should I do
    what is its command

  • pete lowe

    Not a techo – two questions – where do I save auto.inf file to AND am I correct in assuming that if someone puts flashdrive in which also has an autorun program then it will automatically run – if this is the case can I change my autorun program’s name to something like zzxx3426g.exe and will it still run?

  • MM

    Hi! And Help!
    Thanks for the tips. Need help with….
    I can launch the program OK but cannot get my PDF file to open –
    the code that works is:
    action acrobat open program

    But what/where do I add to get the filename.pdf to open right up?
    Tried the shellexecute – nothing.
    Help! 🙂


  • jack

    BS, this is useless. Read into the fine print, this won’t work on Windows 7 machines for a reason.

  • Jonathan

    Problem: Suppose there is a stubborn autorun.inf file that refuses to be deleted or replaced?

  • Dylan Hogue

    not useless, it is posible to run a windows xp or vista emulator which should allow you to use this

  • cmhafiz

    X jadi pun

  • suren prasad

    how to flash drive insite in computer and silent installation of exe

  • Mike brooks

    This is a note to Promo USB Developers: It appears that the autorun.inf file is useless in computers running Win XP SP3 or higher. Recent Microsoft updates have kept the autoplay feature, but disabled the autorun feature in XP SP3 and Vista. It is also set this way by default in Windows 7.

    If the user is motivated to do so, there are work-arounds. However, promotional USB developers must keep this in mind as a statistically large portion of users will no longer be able to use their USB drives as effectively.

    I am putting this here so that it may save you time trying to find a solution when this happens to you.

    Hope this helps.

    This was originally posted on my tech blog Priceless Geek. I will also update this blog if I find a valid solution other than ensuring the root directory of your USB only contains a file that say CLICKME.

    The Microsoft KB article that discuss it is here: http://support.microsoft.com/kb/971029

  • M Kynman

    is there anyway of removing preset options or by using the inf file stopping the autoplay coming up and just running the program? :

  • vinjonue

    Nice nest site for dominators.
    and the ownager nagibators velotrilo frudiators
    srikoesa ad bikrolpaser.
    nice best dest

  • raja

    rock star!

    though the autorun is disabled, but i can assign name and icon 🙂

  • Gerome Ancero

    Really helped me!!
    This is a life saver because my DVD/CD drive is broken And I used my USB
    really thankful!

  • jakie

    oh fuck i wanted to make a virus

  • Great tips.. thanks!