Export (0) Print
Expand All

Setup Information File (.inf) Definition

A basic .inf file contains the following sections (more complex .inf files may have additional sections). Bold section names are reserved keywords. Italicized section names are arbitrary names created by the .inf author:

  • Version section 

  • Install sections 

    • Copy File sections (CopyFiles) 

    • Rename Files sections (RenFiles) 

    • Delete Files sections (DelFiles) 

    • Update .ini File sections (UpdateInis) 

    • Update .ini Fields sections (UpdateIniFields) 

    • Add Registry sections (AddReg) 

    • Delete Registry sections (DelReg) 

    • Add Ini File to Registry sections (Ini2Reg) 

    • Update Config.sys sections (UpdateCfgSys) 

    • Update Autoexec.bat sections (UpdateAutoBat) 

  • DestinationDirs section 

  • SourceDisksNames section 

  • SourceDisksFiles section 

  • Strings section 

  • Optional Components section 

    [Version]

    Basic version information for validating the .inf file.

    [DefaultInstall]

    Installation section that is executed by default. Contains pointers to other sections specifying files to copy and delete, registry updates, .ini file updates, and so on.

    [OtherInstall]

    Uses same format as [DefaultInstall] section, but must explicitly be called. Useful for defining how a component should be uninstalled.

    [DestinationDirs]

    Specifies the location on the hard disk where a section's files are copied, deleted, or renamed (for example, \Windows or Windows\System).

    [FileCopy/Delete/RenameSection(s)]

    Lists files to be copied, deleted, or renamed.

    [RegistryUpdateSection(s)]

    Specifies registry additions or deletions.

    [IniFileUpdateSection(s)]

    Specifies updates to .ini files. Links are created in this section.

    [SourceDisksNames]

    Lists disks that contain the files.

    [SourceDisksFiles]

    Lists the specific disk that each file is on.

    [Strings]

    Lists localizable strings used above.

Version section

[Version]
Signature="$Chicago$"
LayoutFile= filename.inf
Defines the standard header for all Windows .inf files. Note that if the signature is not $Chicago$, then Windows does not accept the .inf file as an .inf file for any of the classes of devices recognized by Windows.

Note that the signature string recognition is not case sensitive. So, for example, you can use either $Chicago$ or $CHICAGO$.

file name .inf
Names the .inf file that contains the layout information (source disks and files) required to install this component. This line is optional. If not given elsewhere, the SourceDisksNames and SourceDisksFiles sections must be given in this .inf file.

The following example shows a typical Version section:

[Version]
Signature="$CHICAGO$"

Install sections

[ install-section-name ]

Copyfiles = file-list-section[,<file-list-section>]...
Renfiles = file-list-section[,file-list-section]...
Delfiles = file-list-section[,file-list-section]...
UpdateInis = update-ini-section[,update-ini-section]...
UpdateIniFields = update-inifields-section[,update-inifields-section]...
AddReg = add-registry-section[,add-registry-section]...
DelReg = del-registry-section[,del-registry-section]...
Ini2Reg = ini-to-registry-section[,ini-to-registry-section]...
UpdateCfgSys = update-config-section
UpdateAutoBat = update-autoexec-section

Identifies the additional sections in the .inf file that contain installation information for the component.

Not all of the item types shown in the syntax above are needed or required in an Install section. If an item type is used, it must specify the name of a section in the .inf file. (An exception to this is the CopyFiles item, which may use the "@" character along with a file name to copy a single file without specifying a section name.) The section name must consist of printable characters.

Only one of each type of item can be used in any one Install section. More than one section name can be listed in an item, but each additional name must be preceded by a comma.

install-section-name
If you name the install section [DefaultInstall], it will run when you right-click the .inf file, and then click Install. This is also the section that is executed when selecting an .inf file as the setup option using the Cabpack wizard.

The following example shows a typical Install section. It contains Copyfiles and AddReg items that identify the sections containing information about which files to install.

[MyApplication]
Copyfiles=MyAppWinFiles, MyAppSysFiles, @SRSutil.exe
AddReg=MyAppRegEntries

In this example, note that by renaming the [MyApplication] section to [DefaultInstall], the install section will run when you right-click the .inf file, and then click Install.

The CopyFiles item provides a special notation that allows a single file to be copied directly from the copy line. You can copy an individual file by prefixing the file name with an @ symbol. The destination for any file copied using this notation is the DefaultDestDir, as defined in the DestinationDirs section. The following example shows how to copy individual files:

CopyFiles=FileSection1,@myfile.txt,@anotherfile.txt,LastSectionName

Copy Files sections (CopyFiles)

[ CopyFiles-section-name ]
destination-file-name[, source-file-name][,temporary-file-name][,flag]
[destination-file-name[,source-file-name][, temporary-file-name]][,flag]

Lists the names of files to be copied from a source disk to a destination directory. The source disk and destination directory associated with each file are specified in other sections of the .inf file. The file-list-section name must appear in the CopyFiles item of an Install section.

Note that you can specify the copying of a single file in the CopyFiles item of the Install section itself, without building a CopyFiles section. To do this, use the special character "@" to force a single file copy. An example of using the "@" character in a CopyFiles-type item is in the Install section reference topic. Copying a single file in this way is somewhat limited because the source and destination file names must be the same in this case, and you cannot use a temporary file.

destination-file-name
Name of the destination file. If no source file name is given, this is also the name of the source file.

source-file-name
Name of the source file. If the source and destination file names for the file copy operation are the same, this is not required.

temporary-file-name
Name of a temporary file for the file copy operation. The installer copies the source file but gives it the temporary file name. The next time the operating system starts, it renames the temporary file to the destination file name. This is useful for copying files to a destination that is currently open or in use by Windows.

flag
Optional parameter used to perform special actions during the installation process. Multiple flags can be used by adding the values to create the combined flag. The following valid flags can be used:

1

On CopyFiles: Warn if user tries to skip file.

1

On DelFiles: If the file is in use, queue up delayed delete in Wininit.ini. Otherwise, a file that is currently in use is not deleted.

2

Setup-critical: Don't allow user to skip the file.

4

Ignore version check and always copy the file. This will overwrite a newer file.

8

Force rename. Setup treats this file as if it's in use. This happens only if the file already exists on the user's computer.

16

If the file already exists on target, don't copy.

32

Suppress version conflict dialog box and don't overwrite newer files.

The following example copies three files:

[CopyTheseFilesSec]
file11 ; copies file11
file21, file22, file23 ; copies file22, temporarily naming it file23
file31, file32 ; copies file32 to file31

All the source file names used in this example must be defined in a SourceDisksFiles section, and the logical disk numbers that appear in the SourceDisksFiles section must be defined in a SourceDisksNames section. As an alternative, you can use a Layout.inf file to supply this information.

Rename Files sections (RenFiles)

[ rename-files-section-name ] 
new-file-name, old-file-name 
.
.
Lists the names of files to be renamed. The name of the section must appear in a Renfiles item in an Install section of the .inf file.

new-file-name 
New name of the file.

old-file-name 
Old name of the file.

The following example renames file42 to file41, file52 to file51, and file62 to file61:

[RenameOldFilesSec]
file41, file42
file51, file52
file61, file62

All the old file names used in this example (file42, file52, and file62) must be defined in a SourceDisksFiles section, and the logical disk numbers that appear in the SourceDisksFiles section must be defined in a SourceDisksNames section.

Delete Files sections (DelFiles)

[ file-list-section ] 
file-name[,,,flag]
.
.
A DelFiles section lists the names of files to be deleted. The file-list-section name must appear in the Delfiles item of an Install section.

file-name 
Identifies a file to be deleted.

flag 
Optional parameter used to force Windows to delete the file named in the item if it is in use during the installation process. To instruct Windows to queue the file deletion operation until the computer has restarted, set the flag parameter value to 1. If a file marked with the flag=1 parameter setting cannot be deleted because it is in use, a system restart will occur after the device installation is complete.

If you do not use the flag parameter value equal to 1 along with a file-name parameter, then the file is not deleted from the computer if it is in use when the DelFiles section is executed.

The following example deletes three files:

[DeleteOldFilesSec]
file1
file2
file3

Update .ini File sections (UpdateInis)

[ update-ini-section-name ] 
ini-file, ini-section, [old-ini-entry], [new-ini-entry], [flags] 
.
.
Replaces, deletes, or adds complete entries in the given .ini file. The section name, update-ini-section-name, must appear in the UpdateInis item in an Install section of the .inf file.

ini-file 
Name of the .ini file containing the entry to change. For more information about specifying the .ini file name, see the comments below.

ini-section 
Name of the section containing the entry to change.

old-ini-entry 
Optional. Usually in the form Key=Value.

new-ini-entry 
Optional. Usually in the form Key=Value. Either the key or value may specify replaceable strings. For example, either the key or value specified in the new-ini-entry parameter may be %String1%, where the string that replaces %String1% is defined in the Strings section of the .inf file.

flags 
Optional action flags. Can be one of the following values:

0

Default. If old-ini-entry key is present in an .ini file entry, that entry is replaced with new-ini-entry. Note that only the keys of the old-ini-entry parameter and the .inf file entry must match; the value of each entry is ignored.

To add new-ini-entry to the .ini file unconditionally, set old-ini-entry to NULL. To delete old-ini-entry from the .ini file unconditionally, set new-ini-entry to NULL.

1

If both key and value of old-ini-entry exist in an .ini file entry, that entry is replaced with new-ini-entry. Note that the old-ini-entry parameter and the .inf file entry must match on both key and value for the replacement to be made. This is in contrast to using an action flag value of 0, where only the keys must match for the replacement to be made.

2

If the key in the old-ini-entry parameter does not exist in the .ini file, then no operation is performed on the .ini file.

If the key in the old-ini-entry parameter exists in an .ini file entry and the key in the new-ini-entry parameter exists in an .ini file entry, then the .ini file entry that matches the key in the new-ini-entry parameter is deleted and the .ini file entry that matches the old-ini-entry parameter is operated on in the following way: the key of the .ini file entry is replaced with the key in the new-ini-entry parameter.

If the key in the old-ini-entry parameter exists in an .ini file entry and the key in the new-ini-entry parameter does not exist in an .ini file entry, then an entry is added to the .ini file made up of the key in the new-ini-entry parameter and the old value.

Note that the match of the old-ini-entry parameter and an .ini file entry is based on the key alone, not the key and the value.

3

Same as flag parameter value of 2 described above, except match of the old-ini-entry parameter and an entry in the .inf file is based on matching both the key and the value, not just the key.

You can use the asterisk (*) wildcard character when specifying the key and value and it is interpreted correctly.

The ini-file name can be a string or a strings key. A strings key has the form %strkey%, where strkey is defined in the Strings section in the .inf file. In either case, the name must be a valid file name.

The name should include the name of the folder containing the file, but the folder name should be given as a logical directory identifier (LDID) rather than an actual name. The installer replaces an LDID with an actual name during installation.

An LDID has the form %ldid%, where ldid is one of the predefined identifiers or an identifier defined in the DestinationDirs section. Note that when the constants LDID_BOOT and LDID_BOOTHOST are replaced, the backslash is included in the path. For example, LDID_BOOT may be replaced with C:\. However, in your .inf file you can either use the backslash character or not. For example, either "%30%boot.ini" and "%30%\boot.ini" can be used to reference BOOT..ini in the root of the boot drive.

The following examples illustrate individual items in an Update .ini File section of an .inf file:

%11%\sample.ini, Section1,, Value1=2 ; adds new entry
%11%\sample.ini, Section2, Value3=*, ; deletes old entry
%11%\sample.ini, Section4, Value5=1, Value5=4 ; replaces old entry

The following set of items in an Update .ini File-type section of an .inf file work together to operate on the Boot section of SYSTEM..ini. The conditionality built into the flags parameter of the .inf file items is used to add the entry "comm.drv=comm.drv" to the Boot section unless the entries "comm.drv=*vcoscomm.drv" or "comm.drv=*r0dmdcom.drv" exist in the Boot section, in which case the existing entry is preserved and the entry "comm.drv=comm.drv" is not added to the .ini file. In other words, after the four .inf file entries shown below are executed, there is one "comm.drv=" entry in the Boot section of the .ini file: "comm.drv=*vcoscomm.drv" or "comm.drv=*r0dmdcom.drv" or "comm.drv=comm.drv."

system.ini, boot, "comm.drv=*vcoscomm.drv","~CommDrvTemp~=*", 3
system.ini, boot, "comm.drv=*r0dmdcom.drv","~CommDrvTemp~=*", 3
system.ini, boot,,"comm.drv=comm.drv"
system.ini, boot, "~CommDrvTemp~=*","comm.drv=*", 3

Update .ini Fields sections (UpdateIniFields)

[ update-inifields-section-name ] 
ini-file, ini-section, profile-name, [old-field], [new-field],[flags] 
.
.
Replaces, adds, and deletes fields in the value of a given .ini entry. Unlike the Update .ini File section type, this type of section replaces, adds, or deletes portions of a value in an .ini file entry rather than the whole value. The section name, update-inifields-section-name, must appear in the UpdateIniFields item in an Install section of the .inf file.

ini-file 
Name of the .ini file containing the entry to change. For more information about specifying the .ini file name, see the topic that describes the Update .ini File section type.

ini-section 
Name of the .ini file section containing the entry to change.

profile-name 
Name of the entry to change.

old-field 
Field value to delete.

new-field 
Field value to add, if not already there.

flags 
Specifies whether to treat the old-field and new-field parameters as if they have a wildcard character or not and/or what separator character to use when appending a new field to an .ini file entry. Can be any of these values:

Value

Meaning

0

(Default) Treat the "*" character literally when matching fields and not as a wildcard character. Use a blank (" ") as a separator when adding a new field to an entry.

1

Treat the "*" character as a wildcard character when matching fields. Use a blank (" ") as a separator when adding a new field to an entry.

2

Treat the "*" character literally when matching fields and not as a wildcard character. Use a comma (",") as a separator when adding a new field to an entry.

3

Treat the "*" character as a wildcard character when matching fields. Use a comma (",") as a separator when adding a new field to an entry.

Any comments in the .ini file line are removed, because they might not be applicable after changes. When fields in this line of the .ini file are processed, spaces, tabs, and commas are used as field delimiters. However, a space is used as the separator when the new field is appended to the line.

Add Registry sections (AddReg)

[ add-registry-section ] 
reg-root-string, [subkey], [value-name], [flag], [value]
[reg-root-string, [subkey], [value-name], [flag], [value]]
.
.
Adds subkeys or value names to the registry, optionally setting the value. The add-registry-section name must appear in an AddReg-type item in an Install section.

reg-root-string
Registry root name. Can be one of the following values:

HKCR Same as HKEY_CLASSES_ROOT
HKCU Same as HKEY_CURRENT_USER
HKLM Same as HKEY_LOCAL_MACHINE
HKU Same as HKEY_USERS.
HKR Means relative from the key passed into GenInstallEx

subkey
Optional. Identifies the subkey to set. Has the form key1\key2\key3.... This parameter can be expressed as a replaceable string. For example, you could use %Subkey1%, where the string to replace %Subkey1% is defined in the Strings section of the .inf file.

value-name
Optional. Identifies the value name for the subkey. For string type, if the value-name parameter is left empty, the value of the subkey specified in the subkey parameter is set to a NULL string. Note that the value-name parameter can be expressed as a replaceable string. For example, you could use %Valname1%, where the string to replace %Valname1% is defined in the Strings section of the .inf file.

flag
Optional. Determines both the value type and whether the registry key is replaced if it already exists.

Value

Meaning

0

(Default) Value is an ANSI string. Replace key if it exists.

1

Value is a hexadecimal number. Replace key if it exists.

2

Value is an ANSI string. Do not replace key if it exists.

3

Value is a hexadecimal number. Do not replace key if it exists.

value 
Optional. Value to set. Can be either an ANSI string or a number in hexadecimal notation and Intel format. Any item containing a binary value can be extended beyond the 128-byte line maximum by using a backslash (\) character. A string key of the form %strkey% can also be given. The strkey must be defined in the Strings section of the .inf file. To use a % character in the line, use %%.

At least two fields are required; however, one can be null. Thus, at least one comma is required when using this form.

The two items in the following AddReg-type section example add two value names to the registry. Note that %25% is expanded to the computer's Windows folder.

[MyAppRegEntries]
HKLM,Software\MyApp,ProgramName,,"My Application"
HKLM,Software\MyApp,"Program Location",,"%25%\MyApp.exe"

Delete Registry sections (DelReg)

[ del-registry-section ] 
reg-root-string, subkey, [value-name] 
[reg-root-string, subkey, [value-name]] 
.
.
Deletes a subkey or value name from the registry. The del-registry-section name must appear in a DelReg item in an Install section.

reg-root-string 
Registry root name. Can be one of the following values:

HKCR Same as HKEY_CLASSES_ROOT
HKCU Same as HKEY_CURRENT_USER
HKLM Same as HKEY_LOCAL_MACHINE
HKU Same as HKEY_USERS.
HKR Means relative from the key passed into GenInstallEx

subkey 
Identifies the subkey to delete. Has the form key1\key2\key3... This parameter can be expressed as a replaceable string. For example, you could use %Subkey1%, where the string to replace %Subkey1% is defined in the Strings section of the .inf file.

value-name 
Optional. Identifies the value name for the subkey. Note that the value-name parameter can be expressed as a replaceable string. For example, you could use %Valname1%, where the string to replace %Valname1% is defined in the Strings section of the .inf file.

This type of section can contain any number of items. Each item deletes one subkey or value name from the registry.

Ini File to Registry sections (Ini2Reg)

[ ini-to-registry-section ] 
ini-file, ini-section, [ini-key], reg-root-string, subkey[,flags] 

.
Moves lines or sections from an .ini file to the registry, creating or replacing a registry entry under the given key in the registry. The section name ini-to-registry-section must appear in an Ini2Reg item in an Install section of the .inf file.

ini-file 
Name of the .ini file containing the key to copy. For more information about specifying the .ini file name, see the comments in the Reference topic about the Update .ini File section.

ini-section 
Name of the section in the .ini file containing the key to copy.

ini-key 
Name of the key in the .ini file to copy to the registry. If ini-key is empty, the whole section is transferred to the specified registry key.

reg-root-string 
Registry root name. Can be one of the following values:

HKCR Same as HKEY_CLASSES_ROOT
HKCU Same as HKEY_CURRENT_USER
HKLM Same as HKEY_LOCAL_MACHINE
HKU Same as HKEY_USERS.
HKR Means relative from the key passed into GenInstallEx

subkey 
Identifies the subkey to receive the value. Has the form key1\key2\key3...

flags 
Indicates whether to delete the .ini key after transfer to the registry and whether to overwrite the value in the registry if the registry key already exists. Can be one of the following values:

Value

Meaning

0

(Default) Do not delete the .ini entry from the .ini file after moving the information in the entry to the registry. If the registry subkey already exists, do not replace its current value.

1

Delete the .ini entry from the .ini file after moving the information in the entry to the registry. If the registry subkey already exists, do not replace its current value.

2

Do not delete the .ini entry from the .ini file after moving the information in the entry to the registry. If the registry subkey already exists, replace its current value with the value from the .ini file entry.

3

Delete the .ini entry from the .ini file after moving the information in the entry to the registry. If the registry subkey already exists, replace its current value with the value from the .ini file entry.

For example, suppose the following entry exists in the Win.ini file:

[Windows]
CursorBlinkRate=15

If a CursorBlinkRate subkey does not exist under Control Panel\Desktop, then the following item in an Ini File to Registry section creates the subkey, sets the value of the subkey to 15, and leaves the original line in WIN..ini unchanged:

win.ini,Windows,CursorBlinkRate,HKCU,"Control Panel\Desktop"

If the subkey already exists, the .inf file item sets the value of the subkey to 15, and leaves the original line in WIN..ini unchanged.

Update Config.sys Sections (UpdateCfgSys)

[ update-config-section ] 
Buffers=legal-dos-buffer-value
DelKey=key
DevAddDev=driver-name,configkeyword[,flag][,param-string]
DevDelete=device-driver-name
DevRename=current-dev-name,new-dev-name
Files=legal-dos-files-value
PrefixPath=ldid[,ldid]
RemKey=key
Stacks=dos-stacks-values

Provides commands to add, delete, or rename commands in the Config.sys file. The section name, update-config-section-name, must appear in the UpdateConfigSys item in an Install section of the .inf file.

Not all item types shown in the preceding syntax are needed or required. An Update Config.sys section may contain as many DevRename, DevDelete, DevAddDev, DelKey, and RemKey items as needed, but the Buffers, Files, and Stacks items may be used only once in a section. When processing an Update Config.sys section, the Installer processes all DevRenames items first, all DevDelete items second, and all DevAddDev items last. The syntax and meaning of each of the types of items that can be used in an Update Config.sys section are provided later in this topic.

Buffers item 

Buffers=legal-dos-buffer-value
Sets the number of file buffers. As it does with the Stacks item, the Installer compares the existing value with the proposed value and always sets the file buffers to the larger of the two values.

legal-dos-buffers-value
A legal MS-DOS buffers value.

DelKey item 

DelKey=key
Causes the Config.sys command with the specified key to be remarked out in the Config.sys file. For example, the following .inf file item:

DelKey=Break

would cause a Break=on command to be remarked out in the Config.sys file.

The DelKey item has the same effect as the RemKey item. There can be multiple DelKey and/or RemKey items in a section of the .inf file.

key
The key of the Config.sys command to be remarked out.

DevAddDev Item

DevAddDev=driver-name,configkeyword[,flag][,param-string]
Adds a device or install command to the CONFIG.SYS file.

driver-name
Name of the driver or executable file to add. The installer validates the file name extension, ensuring that it is .sys or .exe.

configkeyword
Command name. Can be device or install.

flag
Optional placement flag. If 0, the command is placed at the bottom of the file. If 1, it is placed at the top. If flag is not given, 0 is used by default.

param-string
Optional command parameters. Must be valid for the given device driver or executable file.

DevDelete Item

DevDelete=device-driver-name
Deletes any line containing the specified file name from the Config.sys file.

device-driver-name
Name of a file or device driver. The Installer searches the Config.sys file for the name and deletes any line containing it. Because MS-DOS does not permit implicit file name extensions in Config.sys, each device-driver-name must explicitly specify the file name extension.

The following example DevDelete item in an Update Config.sys section deletes lines 1 and 3 but not line 2 of the example Config.sys file:

DevDelete=filename.sys
;; lines in Config.sys
Device=Filename.sys ;; line #1
Install=Filename.exe ;; line #2
Device=Filename.sys /d:b800 /I:3 ;; line #3

DevRename item

DevRename=current-dev-name,new-dev-name
Renames a device driver in the Config.sys file.

current-dev-name
Name of the device driver or executable file to rename. The installer looks for the name on the right side of a device or install command in the Config.sys file.

new-dev-name
New name for driver or executable file.

Files item

Files=legal-dos-files-value
Sets the maximum number of open files in the Config.sys file. As it does with the Stacks item, the Installer compares the existing value with the proposed value and always sets the maximum number of open files to the larger of the two values.

legal-dos-files-value
A legal MS-DOS files value.

PrefixPath item

PrefixPath=ldid[,ldid]...
Appends the path associated with the given LDID to the path command.

ldid
Can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the "Reference" topic about the DestinationDirs section.

RemKey item

RemKey=key
Causes the Config.sys command with the specified key to be remarked out in the Config.sys file. For example, the following .inf file item:

RemKey=Break

would cause a Break=on command to be remarked out in the Config.sys file.

The RemKey item has the same effect as the DelKey item. There can be multiple RemKey and/or DelKey items in a section of the .inf file.

key
The key of the Config.sys command to be remarked out.

Stacks item

Stacks=dos-stacks-values
Sets the number and size of stacks in the Config.sys file. The Installer compares the existing value with the proposed value and always sets the stacks to the larger of the two values. For example, if Config.sys contains stacks=9,218 and an .inf file contains stacks=5,256, the installer sets the new value to stacks=9,256.

legal-dos-stacks-value
A legal MS-DOS stacks value.

Update Autoexec.bat sections (UpdateAutoBat)

[ update-autoexec-section ] 
CmdAdd=command-name[,command-parameters]
CmdDelete=command-name
PrefixPath=ldid[,ldid]
RemOldPath=ldid[,ldid]
TmpDir=ldid[,subdir]
UnSet=env-var-name

Provides commands to manipulate lines in the Autoexec.bat file. The section name, update-autoexec-section-name, must appear in the UpdateAutoBat item in an Install section of the .inf file.

Not all item types shown in the syntax above are needed or required in an Update Autoexec.bat section. The section can contain as many CmdAdd, CmdDelete and UnSet items as needed, but only one PrefixPath, RemOldPath and TmpDir item can be used in an .inf file. The syntax and meaning of each of the item types is described later in this topic.

The installer processes all CmdDelete items before any CmdAdd items.

CmdAdd Item

CmdAdd =command-name[,"command-parameters"]
Adds the given command and optional command parameters to the Autoexec.bat file, at the end of the file.

command-name
Name of an executable file, with or without an extension. If the file name is also defined in the SourceDisksFiles and DestinationDirs sections of the .inf file, the installer adds the appropriate path to the file name before writing it to the Autoexec.bat file.

command-parameters
A string enclosed in double quotation marks or a replaceable string like %String1% or %Myparam%, where the strings that replace %String1% and %Myparam% are defined in the Strings section of the .inf file. The installer appends the string to the command-name before appending the line to the end of the Autoexec.bat file. The format of this line is dependent on the command line requirements of the given executable file.

CmdDelete item

CmdDelete=command-name
Deletes any lines from Autoexec.bat that include the given command name. The installer searches for and deletes any occurrence of the given name that has a file name extension of .exe, .com, and .bat.

command-name
Name of an executable file without an extension.

PrefixPath item

PrefixPath=ldid[,ldid]...
Appends the path associated with the given LDID to the path command.

ldid
Can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the "Reference" topic about the DestinationDirs section.

RemOldPath item

RemOldPath=ldid[,ldid]
Removes the path associated with the given LDID from the path command. For example, if the user installs the new version of Windows into C:\Newwin and has an old copy of Windows in C:\Windows, the following .inf file item removes C:\Windows from the path environmental variable:

RemOldPath=10

ldid
Can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the "Reference" topic about the DestinationDirs section.

TmpDir item

TmpDir=ldid[,subdir]
Creates a temporary folder within the folder given by the LDID, if it does not already exist.

ldid
Can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the "Reference" topic about the DestinationDirs section.

subdir
A path name. If ldid\subdir does not already exist, it is created.

UnSet item

UnSet=env-var-name
Removes any set command from the Autoexec.bat file that includes the given environment variable name.

env-var-name
Name of an environment variable.

DestinationDirs section

[DestinationDirs] 
file-list-section =ldid[, subdir ]
.
.
[DefaultDestDir=ldid[, subdir ]]

The DestinationDirs section defines the destination directories for the operations specified in file-list sections, which are either CopyFiles, RenFiles, or DelFiles sections. Optionally, a default destination folder may be specified for any CopyFiles, RenFiles, or DelFiles sections in the .inf file that are not explicitly named in the DestinationDirs section.

file-list-section
Name of a CopyFiles, RenFiles, or DelFiles section. This name must be referred to in a Copyfiles, RenFiles, or DelFiles item in an Install section.

ldid
A logical disk identifier (LDID). Can be one of the following values:

00

Null LDID - can be used to create a new LDID

01

Source Drive:\pathname

10

Machine folder (maps to the Windows folder on a server-based setup.)

11

System folder

12

IOSubsys folder

13

Command folder

17

Inffolder

18

Help folder

20

Fonts

21

Viewers

22

VMM32

23

Color folder

24

Root of drive containing the Windows folder

25

Windows folder

26

Guaranteed boot device for Windows (Winboot)

28

Host Winboot

30

Root folder of the boot drive

31

Root folder for host drive of a virtual boot drive

subdir 
Name of the folder within the folder named by LDID to be the destination folder.

The optional DefaultDestDir item provides a default destination for any CopyFiles items that use the direct copy (@file name) notation or any CopyFiles, RenFiles, or DelFiles sections not specified in the DestinationDirs section. If a DefaultDestDir is not used in a DestinationDirs section, then the default folder is set to LDID_WIN.

The following example sets the destination folder for the MoveMiniPort section to Windows\Iosybsys and sets the default folder for other sections to be the Bin folder on the boot drive:

[DestinationDirs]
MoveMiniPort=12 ; Destination for MoveMiniPort section is
; windows\iosubsys
DefaultDestDirs=30,bin ; Direct copies go to boot:\bin

SourceDisksNames section

[SourceDisksNames] 
disk-ordinal="disk-description",disk-label,disk-serial-number 
.
.
Identifies and names the disk(s) that contain the source files for file copying and renaming operations.

disk-ordinal 
A unique number that identifies a source disk. If there is more than one source disk, each must have a unique ordinal.

disk-description 
A string or a strings key describing the contents or purpose of the disk. The installer displays this string to the user to identify the disk. The description is enclosed in double quotation marks.

disk-label 
Volume label of the source disk that is set when the source disk is formatted.

disk-serial-number 
Unused. Value must be 0.

This example identifies one source disk. The disk description is given as a strings key:

[SourceDisksNames]
55 = %ID1%, Instd1, 0

[Strings]
ID1="My Application Installation Disk 1"

SourceDisksFiles section 

[SourceDisksFiles] 
file name=disk-number[,subdir] [,file-size]
.
.
color=#000000Names the source files used during installation and identifies the source disks that contain the files.

color=#000000file name 
color=#000000Name of the file on the source disk.

disk-number 
color=#000000Ordinal of the source disk that contains the file. This ordinal must be defined in the SourceDisksNames section, and must have a value greater than or equal to 1 (zero is not a valid disk-number parameter value).

subdir 
Optional parameter that specifies the subfolder on the source disk where the file resides. If this parameter is not used, the source disk root folder is the default.

file-size Optional parameter that specifies the size of the file, in bytes.

color=#000000The following SourceDisksFiles example section identifies a single source file, SRS01.386, on the disk having ordinal 1:

[SourceDisksFiles]
SRS01.386 = 1

Strings section

[Strings] 
strings-key=value 
.
.
Defines one or more strings keys. A strings key is a name that represents a string of printable characters. Although the Strings section is generally the last section in the .inf file, a strings key defined in this section may be used anywhere in the .inf file that the corresponding string would be used. The Installer expands the strings key to the given string and uses it for further processing. You must enclose a strings key in percent signs (%).

strings-key 
A unique name consisting of letters and digits.

value 
A string consisting of letters, digits, or other printable characters. It should be enclosed in double quotation marks if the corresponding strings key is used in a type of item that requires double quotation marks.

The Strings section makes translation of strings for international markets easier by placing all strings that can be displayed at the user interface when the .inf file is used in a single section of the .inf file. Strings keys should be used whenever possible.

The following example shows the strings section for a sample .inf file.

[Strings]
String0="My Application"
String1="My Application Readme File"
String2="CX2590 SCSI Adapter"

Optional Components section

[Optional Components] 
install-section-name 
[install-section-name] 


Lists Install sections that are displayed when the user clicks the Add or Remove Programs icon in Control Panel, clicks the Windows Setup tab, and then clicks the Have Disk button. The Install sections show up as check boxes in the list.

Note that the Optional Components section is ignored when executing an .inf file by right-clicking on the .inf file and selecting the "install" verb. When executing an .inf file in this way, the [DefaultInstall] section is executed. The Optional Components section is also ignored if the .inf file is being executed via the Setupx.dll InstallHinfSection entry point. When executing an .inf file via the SETUPX entry point, the Install section specified in parameter to the entry point is executed.

The Install sections follow the same format as described previously, and the following additional keys can be added to the Install section to drive the interface in the "Have Disk" dialog box:

OptionDesc=option-description 
Tip=tip-description 
InstallDefault=0 | 1 ; Whether to install this component by default. 1=Yes, 0=No.
IconIndex=icon-index 
Parent= install-section-name 
Needs=install-section-name, [install-section-name]
Include =inf-file, [inf-file]

option-description 
String value that is used as the component name in the list box. The option-description parameter may be %String1%, where the string that replaces %String1% is defined in the Strings section of the .inf file.

tip-description 
String value that is displayed in the "description" box when the component is selected in the list box. The tip-description parameter has a 255 character limit, and may be %String1%, where the string that replaces %String1% is defined in the Strings section of the .inf file.

icon-index 
Numeric value that determines the mini-icon that is displayed next to the component name. Valid values are:
0 Machine (base and display)
1 Integrated circuit chip
2 Display
3 Network wires
4 Windows flag
5 Mouse
6 Keyboard (3 keys)
7 Phone
8 Speaker
9 Hard disks
10 Comm connector
11 Diamond (default value)
12 Checked box
13 Un-checked box
14 Printer
15 Net card
16 Same as 0
17 Same as 0 w/ a sharing hand underneath
18 Unknown (question mark)
19 Atwork
20 Greyed check box
21 Dial-up networking
22 Direct cable connection
23 Briefcase
24 Exchange
25 Partial check
26 Accessories group
27 Multimedia group
28 Quick View
29 MSN
30 Calculator
31 Defrag
32 Generic document
33 DriveSpace
34 Solitaire
35 HyperTerminal
36 Object Packager
37 Paint
38 Screen saver
39 WordPad
40 Clipboard Viewer
41 Accessibility
42 Backup
43 Bitmap document
44 Character map
45 Mouse pointers
46 Net Watcher
47 Phone Dialer
48 System Monitor
49 Help book
50 Globe (international settings)
51 Audio compression
52 CD player
53 Media Player
54 Sound scheme
55 Video clip
56 Video compression
57 Volume control
58 Musica sound scheme
59 Jungle sound scheme
60 Robotz sound scheme
61 Utopia sound scheme

Parent 
The list box displayed in the optional components interface can contain sub-levels. If the optional component is a child, the Parent= keyword defines the Install section that is the parent.

Needs 
If this component has dependencies on other components, this defines Install sections that are required by this component. If the component is selected, the user is warned that the component requires the component(s) desribed in the Install section(s) listed on the Needs= line.

Note that the Install sections listed on the Needs= line must be in the same .inf file. However, if dependent components from other .inf files are listed in the Needs= line, the .inf files must be specified on the Include= line.

Include 
The Include item enables you to specify .inf files that Setup must also load into memory when it loads your .inf file, because these .inf files contain sections that must be run in addition to the install sections in your .inf file. The Needs item specifies the names of the sections you intend to run in the included .inf file(s).

The following example defines two optional component install sections; each install section uses the additional entries to specify interface elements and dependencies:

[Optional Components]
InstallMyToys
InstallGames

[InstallMyToys]
OptionDesc=%Toys_DESC%
Tip=%Tomytoysys_TIP%
IconIndex=35 ;Phone mini-icon for dialogs
Parent=MailApps
Needs=MSMAIL, MAPI, MicrosoftNetwork
Include=mos.inf, msmail.inf
CopyFiles=MyToysFiles
UpdateInis=MyToysLinks
AddReg=MyToysRegItems
    
[InstallOtherApps]
OptionDesc=%Other_DESC%
Tip=%Other_TIP%
IconIndex=4 ;windows mini icon for dialogs
CopyFiles=OtherFiles
UpdateInis=OtherLinks
AddReg=OtherRegItems
   
[Strings]
Toys_DESC="Mail Utilities"
Toys_TIP="Additional utilities for sending and organizing mail"
Other_DESC="Other Helpful Utilities"
Other_TIP="Calculator, disk checker and performance monitor"

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft