CD AutoRun basics

CD AutoRun basics
AutoRun runs a program when a CD is inserted into a Windows computer - see below for advice on Apple Macs.

If Windows finds a (plain text) file called AUTORUN.INF in the root directory of a CD then it follows the instructions in this file to run a program. This example AUTORUN.INF file tells Windows to run program setup.exe (from the root directory of the CD):


Use the Windows Notepad application to edit plain text files (it is in the Start All Programs Accessories menu).

Your CD users may have switched off AutoRun. This might be because they are concerned about viruses. Also, if they press the Shift key down while inserting the CD, AutoRun is disabled. In Windows NT4, 2000 and XP systems, only Administrators and Power Users can use AutoRun.

There is no way to force your users to use AutoRun. It is therefore good practice to provide instructions so that users know how to start your CD, eg tell them to open file index.htm in their browser. These instructions are also required if your CD might be viewed by non-Windows users.

So why is ShellRun needed?

Until recently, it was not possible for Windows to AutoRun a file rather than a program.
OK, that’s not strictly true: you could use the following AUTORUN.INF to show web page index.htm

open=start index.htm

However, if you do this, Windows displays a DOS box briefly, which looks nasty. (And start might not be available on some systems.)

If you are only targeting recent Windows systems, then you can use the shellexecute command to open a file without a flickering DOS box:


What does ShellRun do then?

ShellRun overcomes the above problems. It shows your file and displays a neat popup window. The popup appears straight away so that the user knows that something is happening. ShellRun works in all Windows systems.

This example AUTORUN.INF tells ShellRun to show web page index.htm while displaying message “Starting CD now…” in the ShellRun popup window.

open=ShellRun.exe index.htm Starting CD now…

Do not forget to put ShellRun.exe in the root directory of your CD along with AUTORUN.INF.

Viewer Technicalities

All the above AutoRun examples, including ShellRun, use the same core technique to display a file.

Windows associates a viewer program with each file type. For .HTM and .HTML web pages, the viewer program will be your default browser.

If a user does not have a viewer for your file type then it cannot be displayed until a viewer is installed. For example, if you are trying to show a PDF file, the user must have Adobeâ„¢ Acrobat Reader or equivalent installed.

If a viewer is not available, the freeware version of ShellRun just displays a message. In retail version you can prompt the user to run a viewer installation program. See the Viewers page for more details.

If you have a viewer program available then put its installation program on your CD - if you are allowed to distribute it. To distribute Adobeâ„¢ Acrobat Reader, see here: Adobe Acrobat Reader - Download Adobe Acrobat Reader for distribution.

Enabling AutoRun on your computer

To test AutoRun you need to have it enabled on your computer. A registry setting can be used to disable AutoRun. Click Start Run then type in regedit. Select Edit Find and type in NoDriveTypeAutoRun. This value should be found in this key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer .

The NoDriveTypeAutoRun value should be hexadecimal 95 if AutoRun is enabled on all CDs, or B5 if disabled for CDs. (If you want to test AutoRun on a floppy disk, set this value to 91.) You may need to change more than one instance of NoDriveTypeAutoRun in the registry. You usually need to reboot for a new value to take effect.

In Windows 95/98/Me the NoDriveTypeAutoRun value is displayed as 95 00 00 00. In Windows NT4, 2000 and XP this value is displayed as 0×00000095 or hexadecimal 95. If you modify the NoDriveTypeAutoRun value make sure it is still in the correct format.

Filed under Uncategorized |

Leave a Reply

Protected by Comment Guard Pro