As a Windows user you'll undoubtably have noticed that when you drop most CDs in your CD-ROM drive that it automatically starts to run something, usually an installation program. This can be both a blessing and a curse, if you dislike this function then stop reading this tip and go see my Disabling CD Autorun tip. For those of you still with me that have a CD burner, you can make your own homemade CDs autorun as well. You just need an autorun.inf file in the root of the CD.
The autorun.inf file is a simple text file with a fancy extension. The only tool you need to make one is a lousy old text editor like notepad (of course, you would have to rename the file to change the extension from .txt to .inf).
So what's in the file anyway? A series of commands specifying how the whole operation is supposed to work. As it turns out, every command is optional, but if you don't specify anything then your CD won't do anything either. Your autorun.inf file should look like:
[autorun]
command=...
command=...
...
I'm sure you'd like to know what sort of commands you can use, so without further confusion, here they are:
The icon command specifies an icon to represent the Autorun enabled drive (i.e. CD-Drive).
icon=iconfilename[,index]
The label command specifies a label to represent the Autorun enabled drive in the Windows interface. In other words, instead of saying Compact Disc (X:) in explorer it will say label (X:). This supercedes any volume label you may write to your CD.
label=LabelText
The open command specifies the path, filename and any parameters to the application that will run when the user inserts the disc in the drive.
open=[exepath\]exefile [param1] [param2] ...
The shellexecute command is an alternative to the open command. Do not include both commands in your autorun.inf file, I don't know which will take precedence. Rather than specify an application to execute, you can specify any file and Windows will use that file's associated application to open it. Handy if you'd like to open an HTML index file (shellexecute=index.html will bring up index.html in the user's internet browser).
shellexecute=[filepath\]filename
The shell command specifies a default command for the drive's context menu. The context menu is that menu that comes up when you right-click on the drive. If you don't specify anything here, the typical default will be open.
shell=verb
The shell\verb command adds a custom command to the drive's context menu. You can add as many of these as you like.
shell\verb\command=filename.exe
shell\verb=MenuText
shell\Readme\command=notepad.exe readme.txt
shell\Readme=&Read Description
would allow you to press r to run the command once the context menu
is displayed.)
[autorun]
icon=icon.ico
label=Xany's Utilities
shellexecute=html\index.html
shell=Readme
shell\Readme\command=notepad.exe readme.txt
shell\Readme=&Read Description
The above example will use the icon.ico file for the icon of the drive. The drive will be labelled "Xany's Utilities" in Windows. When you place the CD in the drive, Windows will use the user's web browser to open the index.html file in the html folder of the CD. A default context command, Read Description, has been created that will open the readme.txt file on the CD with notepad. The command has a hotkey of 'R' associated with it.
Once you've created your text file, added whatever combination of the above commands you like, and saved the file, make sure you have named the file autorun.inf and have placed it in the root folder (not a folder named root, but the base level folder that contains everything on your disc) of your CD project.
This tip not only works for CDs, but any removable media that supports autoplay features.
If you aren't too comfortable editing the text file yourself, or are just lazy, you could have a look at Autorun Designer which is a freeware program.
Of course, you don't want to make an autorun.inf file, burn your CD and discover it doesn't work. In my forthcoming tip Testing Autorun.inf, I'll describe how you can test your file without potentially wasting a CD.