This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Autorun.inf" – news ·newspapers ·books ·scholar ·JSTOR(September 2010) (Learn how and when to remove this message) |
Anautorun.inf
file is atext file that can be used by theAutoRun andAutoPlay components ofMicrosoft Windowsoperating systems. For the file to be discovered and used by these component, it must be located in theroot directory of avolume. As Windows has acase-insensitive view offilenames, the autorun.inf file can be stored as AutoRun.inf or Autorun.INF or any other case combination.
The AutoRun component was introduced inWindows 95 as a way of reducing support costs. AutoRun enabled applicationCD-ROMs to automatically launch a program which could then guide the user through the installation process. By placing settings in anautorun.inf
file, manufacturers could decide what actions were taken when their CD-ROM was inserted. The simplest autorun.inf files have just two settings: one specifying an icon to represent the CD inWindows Explorer (or "My Computer") and one specifying which application to run.
Extra settings have been added in successive versions of Windows to support AutoPlay and other new features.
autorun.inf
is anASCII text file located in the root folder of a CD-ROM or othervolume device medium (SeeAutoPlay device types). The structure is that of a classic Windows.ini file, containing information and commands as "key=value" pairs, grouped into sections.[1] These keys specify:
Autorun.inf has been used to execute a malicious program automatically, without the user knowing.[2][3][4][5] This functionality was removed in Windows 7 and a patch for Windows XP and Vista was released on August 25, 2009 and included in Microsoft Automatic Updates on February 8, 2011.[3][5][6][7]
The mere existence of an autorun.inf file on a medium does not mean that Windows will automatically read it or use its settings. How an inf file is handled depends on the version of Windows in use, the volumedrive type and certainRegistry settings.
Assuming Registry settings allow AutoRun, then the following autorun.inf handling takes place:
open
orshellexecute
keys. If an AutoRun task is specified it is executed immediately without user interaction.action
key.[9]action
key to appear as an option within the AutoPlay dialog. Otherwise the AutoRun task is omitted.[9]label
andicon
. Any other keys in this section will be ignored. Thus only CD and DVD media types can specify an AutoRun task or affect double-click and right-click behaviour.[9][10]KB971029
for Windows XP and later, that will change AutoRun functionality to this behaviour.[11]This simple autorun.inf file specifiessetup.exe
as the application to run when AutoRun is activated. The first icon stored withinsetup.exe
itself will represent the drive in Explorer:
[autorun]open=setup.exeicon=setup.exe,0label=My install CD
Following are the sections and keys allowed in a valid autorun.inf.[9] There also exist architecture specific section types for systems such as Windows NT 4 running on RISC. However these are long outdated and not described here.
[autorun]
Theautorun
section contains the default AutoRun commands. An autorun.inf file must contain this section to be valid. Keys allowed are:
action=text
action=@[filepath\]filename,-resourceID
open
orshellexecute
keys. The text is expressed as either text or as a resource reference. Theicon
is displayed next to the text. This item is always first in the AutoPlay dialog and is always selected by default. icon=iconfilename[,index]
open
key. label=text
open=[exepath\]exefile [param1 [param2 ...]]
CreateProcess
function that is called by AutoRun. Note that if the application name includes spaces the path should be enclosed in double quote, e.g. open=""spread sheets.exe"" shellexecute=[filepath\]filename [param1 [param2 ...]]
ShellExecuteEx
function that is called by AutoRun. UseAutoPlay=1
open
orshellexecute
are performed.open
orshellexecute
are ignored. shell\verb\command=[exepath\]exefile [param1 [param2 ...]]
shell\verb=menu text
shell=verb
shell\verb
as the default command in the shortcut menu. The default command is the command executed when the drive icon is double-clicked. If missing, the default menu item will be "AutoPlay", which launches the application specified by theopen
entry.shell\readme\command=notepad readme.txtshell\readme=Read & Meshell=readme
[Content]
TheContent
section allows authors to communicate the type and intent of content to AutoPlay without AutoPlay having to examine the media.
Valid keys are:MusicFiles
,PictureFiles
,VideoFiles
. Each key can be set to indicate true or false values and values are not case sensitive.
Example:
[Content]MusicFiles=YPictureFiles=0VideoFiles=false
[ExclusiveContentPaths]
Limits AutoPlay's content search to only those folders listed, and their subfolders. The folder names are always taken as absolute paths (a path from the root directory of the media) whether or not a leading slash is used.
Example:
[ExclusiveContentPaths]\pictures\musicmore music\special
[IgnoreContentPaths]
AutoPlay's content search system will not scan the folders listed, nor their subfolders.IgnoreContentPaths
takes precedence overExclusiveContentPaths
so if a path given in a [IgnoreContentPaths] section is a subfolder of a path given in an [ExclusiveContentPaths] section it is still ignored.
Example:
[IgnoreContentPaths]pictures\musicmore music\special
[DeviceInstall]
This section is used to indicate where driver files may be located. This prevents a lengthy search through the entire contents of a CD-ROM. Windows XP will fully search:
without this section present. All other media should include this section to have Windows XP autodetect any drivers stored on that media.
The section is not used with AutoRun or AutoPlay and is only referred to during a driver installation phase. The only valid key is:
DriverPath=directorypath
which lists a path Windows will search for driver files. All subdirectories of that path are also searched. Multiple key entries are allowed.
If noDriverPath
entry is provided in the[DeviceInstall] section or theDriverPath
entry has no value, then that drive is skipped during a search for driver files.
Example:
[DeviceInstall]DriverPath=drivers\videoDriverPath=drivers\audio[autorun]open=setup.exeicon=setup.exe,0label=My install CD