How do I… Make the autorun.inf file for automatic loading of CDs and DVDs

Burning optical media is a common and accepted practice for data backup, photo albums, music, presentations, and much more. CDs and DVDs are a good way to communicate with customers, investors, and employees. The autorun.inf file can simplify a user's experience by starting the CD or DVD automatically when the media is placed in the drive, and you don't need sophisticated software to make it – all you really need is a text editor.


Contrary to what you may have heard from the RIAA, burning a CD or DVD is not illegal. In many situations, the burned CD is the best way to distribute information to a target audience. For communications involving PowerPoint presentations, HTML, PDF forms, Flash animations, or a number of other applications, the portable and durable CD has become a common delivery method.

The compact disk drive auto play feature, common to most operating systems, is a good way to simplify user experience. Auto play is controlled by a simple text-only file called autorun.inf. While there are dozens of software utilities available that will help you create the file, all you really need is a text editor and some basic knowledge.

Click this tag search to find other How do I… articles and downloads.

Solution 1

The basic configuration of the autorun.inf states the program that is to be run when the CD or DVD is inserted in the drive and the icon that is to be displayed when the disk is viewed by Windows Explorer or other directory listing application. The text-only file, which resides in the root directory of the CD, should something look like this:


The icon file should also reside in the root directory of the CD.


Often the program you want to run will not be located in the root directory of the CD. If that is the case you must include the path in autorun.inf:


Sometimes you may also need to pass an argument to the program to be auto played:

open=myprogram.exe /argument

Not a program

Sending customers, salespeople, investors, and employees presentations, PDF files, and HTML documents requires a slight variation to the basic autorun.inf file. One solution is the addition of a DOS batch file to the CD root directory. The autorun.inf file opens a batch file, which then opens the file using the default program designated for that file type. For example:

open=autorun.bat index.htm

Where the autorun.bat file reads:

echo off@start %1 %2 %3 %4 %5 %6 %7 %8 %9@exit

Using the autorun.inf file to auto play your burned CDs will prevent another headache for your users and increase the likelihood of reaching your target audience. And because it is a simple text file, it can be created with a text editor and your normal disk burning software.

Solution 2

While creating your autorun.inf file according to Solution 1 will work for most of your users, it will fail for a small percentage of users who have issues with the autorun function in their particular installation of Windows. The batch file in the first solution is very rudimentary and makes no allowances for errors. It will unceremoniously fail when an error is encountered.

Extending the solution

Solution 2 was added after the original Solution Base article was published after several TechRepublic members used the article discussion to note the benefits of using shell utilities for the autorun process.

This is where a shell utility can save the day, because these little apps contain routines for handling common errors and will often complete the autorun process even if an error is encountered. For this example, we'll use autorun.exe, which can be downloaded from Tarma Software Research. Tarma has made autorun.exe freely available for both personal and commercial use and there are no requirements for copyright notices, etc.

To use autorun.exe, you make a simple modification to the autorun.inf file by replacing the autorun.bat from Solution 1. The basic autorun.inf would look like this:

open=autorun.exe index.htm

The only other requirement is that a copy of the 8Kb autorun.exe file be included in the root directory of each burned CD. This application also contains several options and supports an extended autorun.inf structure that provides more flexibility in how you design your CD or DVD package.

About Mark Kaelin

Mark W. Kaelin has been writing and editing stories about the IT industry, gadgets, finance, accounting, and tech-life for more than 25 years. Most recently, he has been a regular contributor to,, and TechRepublic.

Editor's Picks

Free Newsletters, In your Inbox