Contrary to what you may have heard from the RIAA, burning a CD-R or CD-RW is not an activity restricted only to music pirates. In many business 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.
This How do I… is based on Microsoft Windows, but other operating systems will read the autorun.inf file in a similar fashion.
Solution One: Create autorun.inf
The basic configuration of the autorun.inf states the program to run when the CD is inserted in the drive and the icon to display when the disk is viewed by Windows Explorer or other directory listing software. The text-only file, which resides in the root directory of the CD, should follow this pattern:
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:
Sometimes you may need to pass an argument to the program to be auto played:
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 and 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:
And the autorun.bat file reads:
@start %1 %2 %3 %4 %5 %6 %7 %8 %9
There is a variation on this idea that takes advantage of the ShellExecute command:
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 Two: Create autorun.inf
While creating your autorun.inf file according to Solution One will work for most of your users, it will fail for a small percentage who have issues with the autorun function in their particular installation of Windows. The batch file in the first solution makes no allowances for errors and will merely fail when an error is encountered.
This is where a shell utility can save the day, because these third-party applications contain routines for handling common errors and will 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 autorun.bat with the .exe file. The basic autorun.inf under this scenario would look like this:
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 package.
Stay on top of the latest XP tips and tricks with TechRepublic’s Windows XP newsletter, delivered every Thursday. Automatically sign up today!