A.3.6.5 Install Section Commands

These commands can only be called from an install section.

CreateDir Command

The CreateDir command creates the specified directory, if it does not exist. If the path specifies more than one nonexistent directory, all are created. The syntax of the command is:

CreateDir Path [V]

FullPath
Specifies the full or partial path of the directory to create.
V
If specified, the Setup program displays an error dialog and terminates if the directory does not exist and cannot be created.
RemoveDir Command

The RemoveDir command deletes the specified directory, if it exists and is empty. The syntax of the command is:

RemoveDir Path [V]

FullPath
Specifies the path of the directory to remove.
V
If specified, the Setup program displays an error dialog and terminates if the directory both exists and cannot be deleted.
Commands to Copy Files

The INF script language provides a set of install section commands that work in conjunction with the [Source Media Descriptions] section to copy files from a distribution disk, a local hard disk, or a network path. The following are the basic steps for using these commands:

  1. Create one or more Files sections containing information about the files to be copied.

  2. Use the AddSectionFilesToCopyList, AddSectionKeyFileToCopyList, or AddNthSectionFileToCopyList commands to extract information from a Files section and add it to the Setup program’s copy list. If necessary, use the ClearCopyList command to remove all copy list entries without copying the files.

  3. Use the CopyFilesInCopyList command. It copies the files specified in the copy list, and then clears the information in the copy list.

All three Add..ToCopyList commands specify the name of the Files section, and the source and destination directories of the files to be copied. The three commands provide different ways to extract files from the Files section. AddSectionFilesToCopyList adds all files in the section, AddSectionKeyFileToCopyList adds the file on the section line identified by a specified key, and AddNthSectionFileToCopyList adds the file on the section line specified by number, where the lines are numbered beginning with 1. The syntax for the CopyList commands is:

AddSectionFilesToCopyList SectionName SrcDir DestDir
 
AddSectionKeyFileToCopyList SectionName LineKey SrcDir DestDir
 
AddNthSectionFileToCopyList SectionName LineIndex SrcDir DestDir
 
CopyFilesInCopyList
 
ClearCopyList
 

A Files section line has one of two formats. The first format specifies another Files section from which to extract files.

[Key =] @(SectionName) [, @(LineKey)]

Key
An optional string that identifies the line.
SectionName
Identifies the Files section.
LineKey
Specifies a line in the Files section. If not specified, all files in the Files section are included.

The second format identifies a file and specifies how to copy it.

[Key =] DiskID, FileName, [Option ...]

Key
An optional string that identifies the line.
DiskID
An integer ID that identifies the distribution disk on which the source file is located. This ID must match a LineKey in the [Source Media Description] section. If the file is not being copied from a removable disk, the disk description and tagfile name on the [Source Media Description] section line are ignored.
FileName
Specifies the base file name and extension (must be 8.3 FAT format) of the source file.
Option
One or more of the options (in any order) described in the next table.

The CopyList mechanism for copying files provides a number of options that determine whether a file is copied, and, if so, how the file is copied. The default behavior is as follows:

You can override these defaults by specifying an option on a Files section line or by setting a global variable (for example, STF_OVERWRITE or STF_UPGRADEONLY). The global STF_ variables specify a different default behavior, which can still be overridden by specifying an option on a Files section line.

Following are the options that can be specified on a Files section line. Note that all file names must use the 8.3 FAT format.

APPEND=DestFile
Appends the contents of the source file to the destination file specified by DestFile. Cannot be used with BACKUP or RENAME options.
BACKUP=SaveFile
If the destination file exists, renames it with name specified by SaveFile. If SaveFile = *, renames the destination file by appending the .bak extension. If a file with the backup name exists, the destination file is not backed up. Cannot be used with APPEND option.
!COPY
The file specified on this section line is not copied.
DATE=YYYY-MM-DD
Used with the OVERWRITE=OLDER option in an update situation to ensure that the destination file is overwritten only if its last write date is earlier than that specified by DATE. YYYY is >= 1980 and <= 2099, MM is in [01..12], and DD is in [01..31].
DECOMPRESS
Decompresses the source file before copying it. If STF_DECOMPRESS is defined to make decompression the default, you can use !DECOMPRESS to override it for a specific file.
DESTINATION=Path
Overrides the destination path specified in the Add..ToCopyList command line, or path specified by STF_DEST. Path must be full path with drive, for example, c:\windows\system32.
OVERWRITE=Option
Specifies when an existing destination file is overwritten. Option is one of the following:
ALWAYS
Always overwrites.
NEVER
Never overwrites. Same as !OVERWRITE.
OLDER
Overwrites if version of destination file is lower than version specified in VERSION option. If VERSION option not used, overwrites if date of destination file is older than date specified in DATE option.
VERIFYSOURCEOLDER
Compares last write times of source and destination files, and overwrites if destination is older.
UNPROTECTED
Overwrites unless destination file is read-only.
READONLY
Sets the read-only attribute of the destination file. If STF_READONLY is defined to make read-only the default, you can use !READONLY to override it for a specific file.
RENAME=NewName
Renames the destination file with the name specified by NewName. This option is useful for specifying the new name of a driver’s oemsetup.inf file. Cannot be used with APPEND options.
SETTIMESTAMP
Sets the create, last access, and last write times of copied files to those of the source file. Note that the FAT file system supports only last write times which are always copied.
SIZE=Size
Estimate of the file size, which Setup uses during copying to display a progress bar graph. Alternative is to use TIME option. If neither SIZE nor TIME is specified, progress is based on number of files copied.
TIME=CopyingTime
Estimate of the time to copy the file, which Setup uses during copying to display a progress bar graph.
UPGRADEONLY
Copies the file only if destination file exists. If STF_UPGRADEONLY is defined to make this the default, you can use !UPGRADEONLY to override it for a specific file.
VERSION=A,B,C,D
Used with the OVERWRITE=OLDER option in an update situation to ensure that the destination file is overwritten only if its version is lower than that specified by VERSION. A is the high-order and B the low-order 16 bits of the most significant portion, and C and D are the high- and low-order 16 bits of the least-significant portion of the file’s binary version number.
VITAL
If specified, Setup displays an error dialog and terminates if the file cannot be copied.
Default Copy Flags

Use the following variables to set the default copy flags. For example, the following INF file line sets the OVERWRITE mode:

    set STF_OVERWRITE = “VERYIFYSOURCEOLDER”

The variables for default copy flags include:

STF_COPY = ““
Turns off copying. No files in the copy list are copied, except those that explicitly specify the COPY option.
STF_DATE = YYYY-MM-DD
Sets the default date to compare with if OVERWRITE=OLDER option is specified. Override by DATE option. Default is “1980-01-01”.
STF_DECOMPRESS = 1
Source files are decompressed before copying. Override by !DECOMPRESS.
STF_DEST = DestDir
Overrides the destination path specified on Add..ToCopyList command line. Must be full path including drive letter. Override by DESTINATION option.
STF_OVERWRITE = Option
Sets the default overwrite mode. One of the following is specified: ALWAYS, NEVER, OLDER, VERIFYSOURCEOLDER, UNPROTECTED
STF_READONLY = 1
Makes it the default to set the read-only attribute of destination files. Override by !READONLY.
STF_UPGRADEONLY = 1
Copies a source file only if the destination file exists. Override by !UPGRADEONLY.
STF_VERSION = A,B,C,D
Sets the default version to compare with if OVERWRITE=OLDER option is specified. Override by VERSION option.
STF_VITAL = 1
If a file cannot be copied, Setup displays an error dialog and terminates. Override by !VITAL.