Creating an AutoRun CD-R Disc

At times it’s useful to create a CD that, when inserted in the drive, automatically loads and runs a specified program or document. For example, you can distribute HTML content on a CD that automatically invokes the user’s browser and loads index.html. The only thing necessary to enable AutoRun for program files is to put a properly formatted AutoRun.inf file in the root directory of that CD. AutoRun.inf is a plain ASCII text file with the following syntax:

[autorun]
Open=CmdLine

Inserting a CD that contains Notepad.exe and Index.html in the root directory and the following AutoRun.inf:

[autorun]
Open=notepad.exe index.html

causes Windows to AutoRun Notepad.exe and load Index.html into it. You can optionally specify a path before the program or document name. AutoRun.inf supports many more options, which are documented at http://www.microsoft.com/msj/0998/win320998.aspx.

Unfortunately, AutoRun does not honor file associations, which makes it difficult to invoke the user’s browser to run an HTML source file automatically. There are several workarounds for this problem, but the one we prefer is the small utility Autohtml.exe, developed by Mark Trescowthick and Ross Mack, which is available for download at http://www.avdf.com/oct98/art_ot005.html. That page includes full instructions for using the utility.

Repeatedly burning CDs while you are testing your custom AutoRun.inf is time-consuming and wasteful. One alternative is to modify the registry to allow ...

Get PC Hardware in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.