Autorun.inf structure and making
- Introduction to Autorun.inf
- Autorun.inf samples
- How to create Autorun.inf?
- Autorun.inf structure and commands
- Autorun.inf drawbacks
- Why Autorun.inf does not work on my or user's computer?
- How to enable/disable Autorun.inf?
- How to test Autorun.inf?
- Autorun.inf and mixed cds
Introduction to Autorun.inf
When you insert a CD into the computer, Windows looks if AUTORUN.INF file is located in the root folder of a CD. If AUTORUN.INF is found, then Windows follows the instructions in this file to run a program. If you want your program, document, presentation or web page to be open, once a CD is inserted, then you need to create AUTORUN.INF file or just use our 1st AutoRun Express utility.
We'll learn AUTORUN.INF structure in details later. Now take a look at the following sample AUTORUN.INF file:
[autorun] open=Setup.exe icon=Setup.exe,1
This sample AUTORUN.INF file tells Windows to run Setup.exe program located in the CD root folder. Also it specifies that Windows should use first icon from Setup.exe to display this CD in Explorer.
How to create Autorun.inf?
You may create and edit AUTORUN.INF file manually (using Windows Notepad) or you may use 1st AutoRun Express utility to create your own autorun CDs with a few clicks!
Autorun.inf structure and commands
AUTORUN.INF is a text file that should contain an Autorun section. This section starts with a header:
and should be followed with commands. There are the following commands available:
Icon command specifies an icon for the CD drive in My Computer. You may specify an icon file directly or an exe/dll file with icons inside and specify an index of the desired icon. Please note, that 1st AutoRun Express allows you to pick icons visually and copies icon automatically to the burning folder if you pick an icon outside the CD.
Label command specifies a text label that is displayed for this CD in Explorer
shell\readme\command=notepad README.TXT shell\readme=Read &me shell\software\command=Setup.exe shell\software=Setup the software
Use a series of shell commands to specify one or more entries in the pop-up menu that appears when the user right-clicks on the CD icon. (The shell entries supplement the open command.)
This example shows how to add two entries to the menu (Read me - to display the README.TXT file in Notepad, and Setup the software - to start the software installation by running the "setup.exe" file.)
Any verb string (without spaces) can appear after "shell\"; "readme" and "software" were used above.
On one line, append "\command=" followed by the command you want to run. On the next line, append "=" and the text that appears in the menu. Put an ampersand character (&) before the character that should be used as the menu item short-cut key.
Windows XP also supports a [DeviceInstall] section in AUTORUN.INF with the DriverPath command specifying a base directory for driver file searches.
[autorun.mips] [autorun.alpha] [autorun.ppc]
AUTORUN.INF may have other sections for other NT/W2000 users, ie MIPS, DEC Alpha, and PowerPC.
Major Autorun.inf drawback is that it only allows you to run programs, but not documents, HTML pages etc.
If you target Windows 2000/XP only, then you may overcome this limitation by using shellexecute command. Otherwise you can try to use the "start" command as in the following example:
[autorun] open=start index.html
However, if you do this, Windows displays a DOS box briefly, and "start" command might not be available on some systems.
And in both cases, if users do not have the appropriate software installed on their system (for example to view DOC files), then they will not be able to read your document!
Another drawback is that you can not start several documents or show a menu.
If you want to open one or several documents, web pages etc. in any Windows version guaranteed, without flickering DOS box, ensuring that user will be able to read your documents, then you may use 1st AutoRun Express utility to create your own autorun CDs and menus with a few clicks.
Why Autorun.inf does not work on my or user's computer?
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.
How to disable Autorun.inf?
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 0x00000095 or hexadecimal 95. If you modify the NoDriveTypeAutoRun value make sure it is still in the correct format.
There are two other - uncommon - ways of disabling AutoRun. The NoDriveAutoRun registry value is in the same key as NoDriveTypeAutoRun. Each bit represents each drive, so hexadecimal 01 disables AutoRun for floppy drive A, 04 disables AutoRun for drive C, 10 disables AutoRun on E. Values can be combined, so 19 disables AutoRun on E, D and A.
If either NoDriveTypeAutoRun or NoDriveAutoRun specify that AutoRun should be disabled for a drive, then it is disabled for that drive.
Finally, programmers might like to know that AutoRun can also be disabled by the program that controls the foreground window by handling the "QueryCancelAutoPlay" Windows message. Please consult the Microsoft documentation for more details.
How to test Autorun.inf?
If you want to preview your autorun CD without actual burning, then you may try the SUBST command. This command allows you to create a virtual drive that is actually a folder on your physical drive.
Copy your autorun CD contents into the specific folder on your CD. Let's it be "C:\My CD". Then click Start|Run and enter:
subst O: "C:\My CD"
Where O: is an unused drive name. Click OK and after this command you will find a new drive O: in My Computer with the same contents as in C:\My CD folder. It should display an icon specified in AUTORUN.INF and when you double-click its icon it will autorun.
To remove substitution later please use the following command:
subst O: /d
Also, when you are using our utility 1st AutoRun Express to create autorun cd, then you may test how autorun will run directly from inside the program.
Autorun.inf and mixed cds
Enhanced CDs contain both music audio and computer data, so they can be played on audio equipment and used on a computer. (Enhanced CDs are also known as CD Extra or CD Plus CDs.) Note that the Mixed-mode CDs also contain audio and data, but these may not be playable on audio equipment.
Note that not all Windows computers will recognise the data on an Enhanced CD, although the audio is always seen. (Windows Me, 2000 and XP usually seem to recognise Enhanced CD data, but it may be drive dependent.) Therefore, do not use this format if you want to be sure that your data is available.
If the Enhanced CD data does not have an AUTORUN.INF file, then Windows will usually start playing the CD when it is inserted. However, if an AUTORUN.INF is present, then Windows will follow the instructions in there rather than playing the CD.
The data on an Enhanced CD can only use short filenames or folder names. Long filenames will be truncated to an "8.3" form, eg "index.html" may appear as "INDEX~1.HTM".