Recipe 3.25. Figuring out AUTORUN.INF Files


You need to know which parameters and data values can be used in AUTORUN.INF files.


The possible key values and their parameters for creating AUTORUN.INF files are defined by Microsoft as follows:


The action entry, used only in Windows XP SP2, specifies the text that is used in the Autoplay dialog for the program named in the open or shellexecute entry in the Autorun.inf file. The value can be expressed simply as text or as a resource referenced in a binary file.


action=ActionText action=@[filepath\]filename,-resourceID


The icon entry specifies an icon to represent the AUTORUN.INF file in Windows Explorer.




The label entry specifies a text label to represent the AUTORUN.INF file in Windows Explorer.




The shellexecute entry specifies an application or data file that autorun will use to call ShellExecuteEx.


shellexecute=[filepath\]filename[param1, [param2]...]


The shell entry specifies a default command for the drive's shortcut menu.




The shell\verb entry adds a custom command to the drive's shortcut menu.


shell\verb\command=Filename.exe  shell\verb=MenuText


This parameter specifies the text that is displayed in the shortcut menu. If it is omitted, the text from verb (above) is displayed. The menu item behaves much like other Windows dialogs the text can be mixed-case, can contain spaces, and may indicate a shortcut/hotkey by putting an ampersand (&) in front of the letter you want to use as the shortcut.


This entry goes under the DeviceInstall section, which is supported only under Windows XP. It specifies a directory to search for driver files. This command is only used during a driver installation. It is recommended that you not hard-code drive letters in the directory path.


The AUTORUN.INF file is a modest but powerful tool, commonly provided in the root directory of CD-ROMs that store data and programs. AUTORUN.INF is used to start installation programs, run demonstration slide shows, or launch multimedia players.

Most AUTORUN.INF files are very simple, like the file in the root of the Windows XP Professional CD-ROM shown below:

[AutoRun] open=setup.exe icon=setup.exe,0

The open= line indicates the program to be automatically run, and the icon= line indicates the icon embedded in the setup.exe file to display in Windows Explorer.

When creating your own multimedia presentation CDs you could specify a full command line to run a PowerPoint presentation or play an MPEG file, as shown below:

[AutoRun] open=powerpoint.exe mypresentation.ppt icon=powerpoint.exe,0


[AutoRun] open=mplayer.exe mymovie.mpeg icon=mplayer.exe,0

You can substitute the filename for an icon or your company logo in place of the default application icon.

You may need to modify the AUTORUN.INF file for a driver installation if you require drivers to be loaded from a specific drive/directory path, or the file provided with the drivers is hard-coded and you want to use a relative path instead.

See Also

MS KB 136214, "How to Test Autorun.inf Files"

Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: