The autorun function enables any media, such as a CD or USB drive, to perform certain commands after inserting into its drive. The autorun file, autorun.inf, enables this functionality.
The autorun file is a simple text file that must have the exact filename "autorun.inf". It usually starts with a line containing "[autorun]":
Commands in general can be specified using the <option>=<value> syntax.
- The open command specifies the path to a program that will run once the media is inserted:
- Command-line parameters may be added. Example:
- The icon command specifies an icon assigned to the media. For example, in Windows, if you open the Computer folder, the icon will appear instead of a default icon for the media type. Example:
- To access an icon resource, specify the index of the icon preceded by a comma. Example:
- The label command specifies a custom name for your media. For example, if you want to name your floppy disk into "Financial Reports", add this to the autorun file (you have to create one if it does not exist):
- The shell command specifies an option value to run as the default action when the media is opened manually, for example, double-clicking it in the Computer folder.
shell=gbexec.exe (basically similar to the open command)
- The shell\<option> command adds a context menu option applied to the corresponding media folder. The shell\<option>\command command sets the program associated with the item. Setting shell=<option> will make that option the default action. The items can be nested, delimited by a reverse solidus/backslash (\). You can also specify hotkeys by preceding the hotkey letter with an ampersand (&). Example:
- The shellexecute command opens a file in your computer or a URI using the default program for that file or protocol. Example:
shellexecute=http://www.example.com. Apparently, this can also be used as replacement for the open command (that is, you can also specify programs).