Instructables
Picture of How to make an Autorun.inf File
In a previous Instructable, I went over this quickly and did not explain it very well. I was asked to make a full Instructable on Autorun.inf files, and here it is.

An Autorun.inf file is a file that, when placed on a drive (internal or external), will allow the drive to start programs, have a different icon than the standard boring one (LOTS OF FUN TO MESS WITH), and have a different name. The syntax is "option=value". Examples will be given later on.

Continue if you want to learn more.

ANOTHER UPDATE ON PAGE 4
 
Remove these adsRemove these ads by Signing Up

Step 1: A Basic Autorun File

In this step, we will make a basic, do-nothing Autorun file. All that will change is the name of the USB drive, and the icon that goes with it.

Open Notepad (or Notepad++ or what ever you use) and type the following:

autorun
icon=NAME.ico
label=NAME

BEFORE YOU SAVE IT!
Where it says autorun, insert brackets around the word. I cannot type this in the Instructable, as it the Instructable creating software would turn the word into a link. Refer to the picture for the correct format.

Here is what you typed:
autorun: This states that this is an Autorun file, and what follows describes what the drive will look like and how it will act.

icon: This will change the icon of the drive (in the "My Computer" screen) to a custom one that you choose. The picture you choose must be an icon file (it must have the extension ".ico"). You can get pictures of that format from http://www.iconarchive.com/ and many other websites.

label: This will change the name of the drive to whatever you choose, as long as what you choose does not contain too many characters.

OK. Save the file to the main directory on your drive ("My Computer, Removable Drive X"). Eject the drive, then plug it back in. If you saved it to an internal hard drive, you will have to restart the computer.

If you are adding an icon to the drive, you will need to have an icon file to go use. An icon file is NOT a picture you got off the internet. It must have the extension ".ico". If it does not, then it will not work. Place the icon in the same directory as the Autorun file. Once you have done this, go back into the Autorun file and change the line that says icon=NAME.ico to have the name of the icon (keep the part that has the ".ico".

Step 2: A More Complex Autorun

Picture of A More Complex Autorun
main.bmp
If you want a USB drive that actually does something when you plug it into a computer, then this is the step for you.

Type the following into Notepad or Notepad++:

autorun
icon=NAME.ico
label=NAME
open=FILE.EXT
action=ACTION NAME

This is a short explanation of the new stuff you just typed:

open: Duh. This will open a file that you choose. If that file is in a folder, you would type the following:
open=.\Folder\File.ext

action: This is what you want the option to be called. If you remember, the option's name on the first page was "Heal People". Refer to the picture to see what I mean.

Step 3: An Autorun file with extra Commands

The previous steps just messed with the name, icon, and actions of the USB drive. Now, I will show you how to add extra commands to the USB drive. These commands will show up when you right-click on the USB drive.

If you lose your USB drive often, you should 1) buy a keychain for it and 2) add this to your Autorun file:

shell\lost\command=Lost.bat
shell\lost=Help! I'm Lost

NOTE: This command is not only for a lost USB drive. You can make it anything you want.

shell\lost\command=: This is the file that will open when you click on the "Help! I'm Lost" command.

shell\lost=: This is what the name of the command is. Look at the picture for more information.

Also, the computer does not have a file called "Lost.bat" already on it (duh). You will have to make one. This is some good code for the batch file:

:top
@echo off
title Please Return Me!
cls
echo I have been lost! Please return me to my owner!
echo 1234 Second St. Small Town, America, 12345
echo 1-555-555-5555
echo return-me-please@gmail.com
pause
goto top

I have written this code so that if someone presses a key (like the file asks you to, see the screenshot), it will simply repeat itself! It will continue to do this untill the finder of the drive closes out of the CMD window.

PLEASE make sure that you replace the info with your actual address, phone number, and email (unless you happen to live at 1234 Second Street, Small Town, America, 12345).

There are countless possibilities that you can place here. Also, you can insert more than one, so you could have a "Help Me" option, a "Hello" option, and a "Destroy the Earth" option. Have fun with that (and be legal!).

Step 4: The End

Picture of The End
Well, I hope that you found this helpful. I know that there are many more commands that I left out, and I did that because I did not want to have to explain them to some little kid who just wants to give his new 1gig a power-rangers icon.

Feel free to leave comments, give suggestions, make corrections, and vote.

UPDATE
If you have trouble making the autorun file, you can download the text file version of one I made. Just replace the information inside it and save it as a .inf file.

ALSO, the icon and open fields cannot have multiple words in them. Use the underscore symbol if you have to, but NO spaces.
autorun.txt96 bytes
1-40 of 77Next »
RiekeM1 month ago

[autorun]

Open=DHCA-TV.mp4

Icon=My_Icon.ico

ShellExecute=DHCA-TV.mp4

UseAutoPlay=1

Why nothing happend even if all setup is already allowed (I use win 8) ?

Want to make autorun for TV. So, I just plug the usb, it will run automatically.

Please help, thanks....

OPen and ShellExecute cannot open multimedia files.

binary files only.

ramagodz1 month ago

Windows 7 has prevention for Autorun script. So that's why you can't use this method.

Well, I can get the Autorun Label and Icon properties to work, but the Open and Action commands are not working.

[AutoRun]

icon=.\H.ico

label=Stamboek

action=Open Menu

open=.\SBookMenu.exe

This may have something to do with the fact that I'm opening it from an SD card...? Any suggestions?

I have made an autorun.inf to fun an application on my USB automatically ,but it does not work on Win7.......Is there a solution???

JakaramaO4 months ago

For some reason my open, action, and shell command won't work.

[AutoRun]

Icon=Mathijssen-Tuxlets-Balloon-Tux.ico

label= 2gb

open=scratch\2d_brawler.sb

Action=Start scratch

shell\lost\command=Lost.bat

shell\lost=Help! I'm Lost

OompaG JakaramaO3 months ago

I'm PRETTY certain that open was removed in win 7 for security reasons, however I'm unsure of the rest.

vigneshb159 months ago

HI guys,

I am using windows 8, I want to run AppName application(.exe) while insert a Pen drive on my pc.

This is my autorun.inf file in Pen drive.

Here i notified that label, icon are displayed. But the exe is not executed. (Open Command doesn't work for me)

[autorun]

label=LAVA

ICON=.\DESK.ico,0

open=AppName.exe

Any suggestions please.....???

goodiesohhi11 months ago
Starting from windows 7 autoplay from Removable disks have been restricted due to security purposes everything but the icon and label line is ignored....
It still works with CD/ROMS
Stan200012 months ago
you guys are all saying that it doesnt work on windows 7 and 8 but can someone please post a way to pass the security of windows?
kysinden1 year ago
Windows 7 prevents the use of custom autruns as it makes viruses extremely easy to spread virus and stuff/thangs.
the autorun not working for me.WHY?????????
fahmad31 year ago
The problem is windows 7, I tried on win XP and it worked fine, it also works for vista
fahmad31 year ago
The icons are fine but this isnt working, please help
fahmad31 year ago
This isnt working
I created an autorun like this:
[autorun]
label=gta_san
icon=icon.ico
shell\lost\command=Autorun.exe
shell\lost=Install
fahmad31 year ago
Thanks, this information was very helpful,

Can you make an instructable on "How to Create Log Files"
I'll be very thankful my email is: carljhonson623@gmail.com
Thanks
achhabra12 years ago
how to make autorun of devicon.fil and devlogo.fil files?????
parth_13132 years ago
Hello I m new out here .
Can v make 2 autorun files in a single pendrive
my auto run:

[autorun]
open=beaboss.exe
action=Be a boss!
icon=HD Box2.ico
label=MurphDrive

Wy won't it run?
action=Be a boss!

You are not allowed to use strange characters in this small batch script.
Thats why it dont works.
thanks
pfouquet3 years ago
Here is my auto run,
[Autorun]
Icon=usb.ico
Open=Portable Apps\StartPortableApps.exe
Action=Start PortableApps
Label=PierreFouquet

although i cannot open the program with it,
my usb is on my F: drive, and the dir of the files is correct, i have made sure, whats wrong?
Simple to explain,

An autrun file has been created for optical drives like cd-roms and dvd-roms. These days these files are still used to install applications from optical drives and are autrun files on flash drives used only to show manufactorers icons.
the problem is windows 7, they took the (they being MS) fuctionality out, for security reasons, i am running it currently, so if you have Win7 you can use autorun, Vista n XP still can
pokeroz3 years ago
was wodering if u knew how to make auto run open a .exe on the usb and by the way great interstruable
fix your grammar, "wodering, interstruable" really? I'm thirteen and I have better grammar than you, sad.
spelling. fix your spelling. *facepalm..... silly thirteen year old
Ba, too true. As unfortunate as that is. I wonder how he even gets on here with spelling like that.
While you are on a grammar kick, furry, you should really combine your first two "sentences" into one parenthetical idea. Observe:

"Ba, too true. As unfortunate as that is." now becomes: Ba, too true (as unfortunate as that is).

As your comment stands, the second sentence: "As unfortunate as that is.", is a fragment.

Have a nice day.
Besides, this was almost a year ago.
I shouldn't have said some of the stuff I previously said and I am now almost fourteen and can see what a stupid seventh grader I was being at the time. I now am much smarter and I tend to be nicer too.
No need to be a ___ about it. He is probably from another country.
I guess you are right, well at least I hope that. I shouldn't have been so harsh.
Berkin4 years ago
I made a program in Visual C# that makes these files for me.. :D
sescott Berkin3 years ago
can you send me instrunctions or an installer for that program or something, i dont get any of the autorun stuff, so it would help so much, email me at: sme272@hotmail.com
jwish137963 years ago
my autorun wont let me open files
Mine won't either. :/ ???
______ jmarri3 years ago
The problem is once you have made the autorun.inf file, pull your drive (like a flash drive) out of the computer and stick it back in.
pfouquet ______3 years ago
the problem is possibly windows 7, they took the (they being MS) fuctionality out, for security reasons
______ pfouquet3 years ago
Not on mine they didnt, so maybe it is your computer, they took it out on.
1-40 of 77Next »