Introduction AutoRun used to be called AutoPlay. The term AutoPlay now describes a (similar) Windows XP feature that launches an application to display picture, music or video content on removable devices. Programmer's guide to AutoPlay 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): [autorun] open=setup.exe icon=snazzie.ico 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 [autorun] 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: [autorun] shellexecute=index.htm 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. [autorun] 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 0x00000095 or hexadecimal 95. If you modify the NoDriveTypeAutoRun value make sure it is still in the correct format. More ways to disable AutoRun 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. More AutoRun options You can set further options in the AUTORUN.INF file. You can provide an icon for the CD drive in My Computer by adding a line that set the icon command to an .ICO file. You can set a text label for the drive using the label command. For example: [autorun] open=ShellRun.exe report.mpg Showing video now... icon=snazzie.ico label=Snazzy Report 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 Software list - to show HTML file software.htm): [autorun] ... shell\readme\command=notepad README.TXT shell\readme=Read &me shell\software\command=ShellRun.exe software.htm shell\software=Software list 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.INF may have other sections for other NT/W2000 users, ie MIPS [autorun.mips], DEC Alpha [autorun.alpha] and PowerPC [autorun.ppc]. -------------------------------------------------------------------------------- Enhanced CDs - music and data 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.) A test Apple Mac (iMac OS 9) did not recognise either the audio or the data. 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 retail version of ShellRun has an option to start playing the audio - see here for details. -------------------------------------------------------------------------------- AutoStart on Macs The equivalent to AutoRun on Macs is called AutoStart. This only works if QuickTime 2.0 or later is installed, and AutoStart is enabled. Technical information It is possible to create an AutoStart CD on a Mac, using tools such as Autostart DropStart. MacImage for Windows says that it can create AutoStart CDs on a PC. Other tools: List. mkisofs. CDEveryWhere. Toast for Mac. We have not tested any of these products. Keiser Photography have instructions for using Toast to make a CD that will AutoStart on a Mac as well as using ShellRun to AutoRun on Windows computers. Filenames as seen by a Mac By default, CDs created on a PC might have garbled filenames when viewed on an old Mac. Long filenames will be truncated to an "8.3" form, eg "index.html" may appear as "INDEX~1.HTM" on a Mac. However OS X 10.2.6+ recognises long file names. However, a pre OS-X Mac user can install the shareware Joliet File System Extension, from http://www.tempel.org/joliet/, which will make long PC filenames readable. If your CD uses the Joliet format because it has long filenames, then suggest to your Mac users that they install this software to view the CD fully. Therefore, if you have Mac users, it is best to ensure that your filenames are short, and provide instructions for viewing the CD manually, eg "View this CD by opening INDEX.HTM in your browser".