WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

CD-ROM Drives

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Details about the Autorun.inf File on a CD-ROM

Keywords:      Autorun.inf

The Autorun.inf File:

The Autorun.inf file is a text file located in the root directory of the compact disc. This file contains the name of the startup application on the disc (the application that runs automatically when the disc is inserted in the CD-ROM drive), and the icon that you want to represent the AutoPlay-enabled compact disc in the Windows user interface. The Autorun.inf file also can contain optional menu commands that you want added to the shortcut menu, which is displayed when the user right-clicks the CD-ROM icon.

At a minimum, an Autorun.inf file contains three lines of text and identifies the startup application and the icon, as shown in the following example:

[autorun]
open=filename.exe
icon=filename.ico
The [autorun] section identifies the lines that follow it as AutoPlay commands. An [autorun] section is required in every Autorun.inf file. The open command specifies the path and file name of the startup application, and the icon command specifies the file that contains the icon information.

The Autorun.inf file also can contain architecture-specific sections for Windows NT 4.0 running on RISC processors. For each type of processor architecture, add a section to the Autorun.inf file that contains the file name of the startup application you want to run for that architecture. For x86 architectures, use the standard [autorun] line. Use [autorun.mips] to run an application on MIPS architecture, [autorun.alpha] for applications on the Alpha architecture, and [autorun.ppc] for the PowerPC architecture. The following example shows how to create an Autorun.inf file that runs different startup applications depending on the computer architecture:

[autorun]
open=filename.exe
icon=filename.ico

[autorun.mips]
open=filenam2.exe
icon=filename.ico

[autorun.alpha]
open=filenam3.exe
icon=filename.ico

[autorun.ppc]
open=filenam4.exe
icon=filename.ico
The shell checks for an architecture-specific section first. If it does not find one, it uses the information in the [autorun] section. After the shell finds a section, it ignores all the other sections, so make sure each section contains all the information for that architecture.

Another User Continues...

Here's some thoughts that I have about it, plus some factual information from a book about the Win95 registry that I have...

  1. AUTORUN.INF should be located in the root directory of the drive on which it is located. It should have the following format (at a minimum) to work properly:
    [autorun]
    open = program.exe
    icon = program.ico
    
    Where 'program.exe' is the name of a program in the root directory of the drive and 'progarm.ico' is either a icon file or an executable file from which an icon is to be pulled (index #0).

  2. Now, the fun part that deals with the registry is up next.

    By default, Windows 95 is configured to recognize an AUTORUN.INF file on various media and to ignore it on others, based on the Registry key shown here. The default Data entry also shown here can be revised as desired:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
    
    • Name Data

    • NoDriveTypeAutoRun 95 00 00 00

    The first data byte (95 = 1001 0101) is a bit mask in which each bit set to 1 prevents a certain drive type from being recognized for AUTORUN.INF processing according to the following list:

    Bit # Drive Type
    
    0 unknown
    1 "NO_ROOT_DIR" (undocumented)
    2 Removable
    3 Hard drive
    4 remote
    5 CD-ROM
    6 RAM
    7 reserved
    
    To enable remote (network) drives for AUTORUN.INF processing you need to change the value from 95 (hex) to 85 (hex) (1000 0101 binary).

    The TweakUI utility, if I recall correctly, has a GUI that lets you manipulate this setting, but I may be mistaken.

    Keep in mind that this is coming directly from a Win95 Registry reference manual. I have only been able to do a limited amount of testing.

  3. My testing has been conducted as follows:
    1. Registry changes made to a Win95 OSR2 PC.
    2. AUTORUN.INF and some test "open" and "icon" files copied to a directory on a Netware 5 server volume.
    3. Login to an NDS tree and MAP ROOT a drive letter to the volume & directory in which the autorun-related files were placed.
    4. Open the Windows explorer and verify that the network drive appears with the desired icon (per the AUTORUN.INF) file and that a right-click on the drive shows the 'Autoplay' popup menu item (as a default item).
    5. Double-click on the drive and verify that the program identified by the 'open' keyword in the AUTORUN.INF file gets launched properly.
    I performed these steps and they worked just fine.

    I have not tested with a WinNT share instead of mapped drive letter from a Netware server.

    I have not tested either type of server with a WinNT client.

Regarding the 'icon' keyword in the AUTORUN.INF file:
The value assigned to this keyword may be the name of an icon (.ico) file or an executable/DLL file. If either an executable (.EXE) or DLL (.DLL) file is specified, then the name of the file may be followed by a comma ',' character and a decimal number indicating the index of the icon resource that is to be extracted from the file.

Additional Notes:

Regarding file paths in the AUTORUN.INF file:
The AUTORUN.INF file itself must be located in the root directory of the drive on which it is located. However, the icon file and program file to be 'opened' can be down a path relative to the root of the drive and can be referenced via relative path names.

Addendum:

I just finished some more testing. The registry change works as documented on both Win95 and WinNT systems and with network drives connected to both WinNT and Netware servers.

The only identifiable difference in behavior is that the Explorer on Win95 reconized the registry change and worked immediately. The Explorer in WinNT had to be restarted, e.g. logoff and logon again, before the registry change was recognized.


And yet another user offered the following:

I wanted to make a portable version of our website and burn it to CD-R. Someone provided me with this code that's worked for me:

On the root of your cd-r image:

  1. Make an "autorun.inf" with the following two lines: [autorun]
    open = autorun.bat yourfoldername\homepage.htm
    

  2. Also make an "autorun.bat" with the following two lines:
    @start %1 %2 %3 %4 %5 %6 %7 %8 %9
    @exit
    
If you have your script in your homepage.htm document, that ought to do it for you. I also really don't understand why this works, it's pretty strange looking code to me, but it runs fine on all the Windows platforms we've tried. I'd be really curious is anyone can explain what's going on in the autorun.bat.

autorun.bat explanation

What is happening here, is the CD gets put in the drive, and windows opens the AUTORUN.INF file, and executes the AUTORUN.BAT file, passing "yourfoldername\homepage.htm" as a parameter. The AUTORUN.BAT file gets executed, and immediately all instances of %1 get replaced with "yourfoldername\homepage.htm". %2, %3, %4 etc get replaced with just blank spaces because they were not specified.

Now your autorun.bat file, effectively looks like this:

       @start yourfoldername\homepage.htm
       @exit
The BAT file executes the "START" command, which is a windows command that is identical to the Run... command on the start menu. It tells windows to run the "yourfoldername\homepage.htm" file, which causes windows to open Internet Explorer with that webpage displayed. The next command is EXIT, which just tells the console window to close. Both these commands are prefixed with a "@", so they are completely silent. Windows doesn't display a command prompt, and the only visible effect shown is windows magically opens Internet Explorer, navigating automatically to a webpage of your choosing. Tada!!
Article ID:   W13206
Filename:   The Autorun.inf File on a CD-ROM.txt
File Created: 2005:01:21:08:48:56
Last Updated: 2005:01:21:08:48:56