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.


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:


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

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++:


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:

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=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:

@echo off
title Please Return Me!
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
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

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.

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.
<p>Help when I run a Autorun.inf it cant find grldr and when I do some more things to try fix it is goes to grub</p>
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?
<p>Microsoft disabled the autorun.inf features(not all of them, but most of them) due to security issues, the only way to bypass it would be to write a script on the computer itself that would<br>1)check for connected devices<br>2)check for a specific file on those devices(such as &quot;autorun.dll&quot;)<br>3)open/run that file</p><p>---</p><p>You would have to have that script installed and running on any computer that you would want to bypass the security system for.</p>
<p>open does not work with windows 10</p>
<p>You can use a u3 drive to get around it, it thinks it is a cd and cd:s have permission for autorun. Have not tried it yet but I think it will work.</p>
<p>you need to convert him to cd format or it won't work</p><p>this is how you do it but first save your file for limited files on your pc becouse it wil be cleaned too</p>
<p>... No XP either.</p>
<p>You can use a u3 drive to get around it, it thinks it is a cd and cd:s have permission for autorun, I think...</p>
<p>OKAY. Let me explain something to you. autorun cannot start programs in windows 7 and up. There is no way around it. i tried every trick you guys put in comments, none of them work. the only way to autorun is to download an application that permits it ON YOUR COMPUTER ONLY.</p>
how do i put more than one open=open.exe in the autorun file?
<p>write in the file</p><p>open=open1.exe<br>open=open2.exe</p>
<p>At least I managed to do step one which could be useful, sadly I wasn't able to give the option for autorun a file which would have been useful, from what it looks like it might be because I am doing this on Windows 7.</p>
Here is my auto run, <br>[Autorun] <br>Icon=usb.ico <br>Open=Portable Apps\StartPortableApps.exe <br>Action=Start PortableApps <br>Label=PierreFouquet <br> <br>although i cannot open the program with it, <br>my usb is on my F: drive, and the dir of the files is correct, i have made sure, whats wrong?
<p>Open=usb\directory of exe.file</p>
Simple to explain,<br><br>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
<p>I did it!</p>
<p>Hey guys! i am trying to make an autorun.inf file of a batch file the coding of autorun.inf is this </p><p>[autorun] </p><p>icon=jatin bal.ico </p><p>label=Removable Disk </p><p>open=JB Anti-Virus.bat </p><p>action=Mouse Disable</p><p>and it is not working (i am using win 7 &amp; win 8) only it changes the drive name and icon do not autorun the file. can anybody tell me what happen. Please help me!</p>
<p>Hey guys! i am trying to make an autorun.inf file of a batch file the coding of autorun.inf is this </p><p>[autorun] </p><p>icon=jatin bal.ico </p><p>label=Removable Disk </p><p>open=JB Anti-Virus.bat </p><p>action=Mouse Disable</p><p>and it is not working (i am using win 7 &amp; win 8) only it changes the drive name and icon do not autorun the file. can anybody tell me what happen. Please help me!</p>
<p>[autorun]</p><p>Open=DHCA-TV.mp4</p><p>Icon=My_Icon.ico</p><p>ShellExecute=DHCA-TV.mp4</p><p>UseAutoPlay=1</p><p>Why nothing happend even if all setup is already allowed (I use win 8) ?</p><p>Want to make autorun for TV. So, I just plug the usb, it will run automatically.</p><p>Please help, thanks....</p>
<p>OPen and ShellExecute cannot open multimedia files.</p><p>binary files only.</p>
<p>Windows 7 has prevention for Autorun script. So that's why you can't use this method.</p>
<p>Well, I can get the Autorun Label and Icon properties to work, but the Open and Action commands are not working. </p><p>[AutoRun]</p><p>icon=.\H.ico</p><p>label=Stamboek</p><p>action=Open Menu</p><p>open=.\SBookMenu.exe</p><p>This may have something to do with the fact that I'm opening it from an SD card...? Any suggestions?</p>
<p>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???</p>
<p>For some reason my open, action, and shell command won't work.</p><p>[AutoRun]</p><p>Icon=Mathijssen-Tuxlets-Balloon-Tux.ico</p><p>label= 2gb </p><p>open=scratch\2d_brawler.sb</p><p>Action=Start scratch</p><p>shell\lost\command=Lost.bat</p><p>shell\lost=Help! I'm Lost</p>
<p>I'm PRETTY certain that open was removed in win 7 for security reasons, however I'm unsure of the rest.</p>
<p>HI guys,</p><p>I am using windows 8, I want to run AppName application(.exe) while insert a Pen drive on my pc. </p><p>This is my autorun.inf file in Pen drive.</p><p>Here i notified that label, icon are displayed. But the exe is not executed. (Open Command doesn't work for me)</p><p>[autorun]</p><p>label=LAVA</p><p>ICON=.\DESK.ico,0</p><p>open=AppName.exe </p><p>Any suggestions please.....???</p>
Starting from windows 7 autoplay from Removable disks have been restricted due to security purposes everything but the icon and label line is ignored.... <br>It still works with CD/ROMS
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?????????
The problem is windows 7, I tried on win XP and it worked fine, it also works for vista
The icons are fine but this isnt working, please help
This isnt working <br>I created an autorun like this: <br>[autorun] <br>label=gta_san <br>icon=icon.ico <br>shell\lost\command=Autorun.exe <br>shell\lost=Install
Thanks, this information was very helpful, <br> <br>Can you make an instructable on &quot;How to Create Log Files&quot; <br>I'll be very thankful my email is: carljhonson623@gmail.com <br>Thanks
how to make autorun of devicon.fil and devlogo.fil files????? <br>
Hello I m new out here . <br>Can v make 2 autorun files in a single pendrive
my auto run:<br><br>[autorun]<br>open=beaboss.exe<br> action=Be a boss!<br>icon=HD Box2.ico<br>label=MurphDrive<br><br>Wy won't it run?
action=Be a boss!<br><br>You are not allowed to use strange characters in this small batch script.<br>Thats why it dont works.
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, &quot;wodering, interstruable&quot; 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 &quot;sentences&quot; into one parenthetical idea. Observe:<br><br>&quot;Ba, too true. As unfortunate as that is.&quot; now becomes: Ba, too true (as unfortunate as that is).<br><br>As your comment stands, the second sentence: &quot;As unfortunate as that is.&quot;, is a fragment.<br><br>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.<br>
I guess you are right, well at least I hope that. I shouldn't have been so harsh.

About This Instructable



More by Crazy Leprecaun:How to Secure Your USB Drive How to make an Autorun.inf File How to Make System Hidden Files and Folders 
Add instructable to: