INF DelFiles Directive
Note If you are building a universal or mobile driver package, this directive is not valid. See Using a Universal INF File.
A DelFiles directive references an INF-writer-defined section elsewhere in the INF file, and causes that list of files to be deleted in the context of operations on the section in which the referring DelFiles directive is specified.
[DDInstall] | [DDInstall.CoInstallers] | [ClassInstall32] | [ClassInstall32.ntx86] | [ClassInstall32.ntia64] | (Windows XP and later versions of Windows) [ClassInstall32.ntamd64] (Windows XP and later versions of Windows) Delfiles=file-list-section[,file-list-section]...
A DelFiles directive can be specified within any of the sections shown in the formal syntax statement. This directive can also be specified within any of the following INF-writer-defined sections:
- An add-interface-section referenced by the AddInterface directive in a DDInstall.Interfaces section.
- An install-interface-section referenced in an InterfaceInstall32 section
Each named section referenced by a DelFiles directive has one or more entries of the following form:
[file-list-section] destination-file-name[,,,flag] ...
A file-list-section can have any number of entries, each on a separate line.
Do not specify a file that is listed in a CopyFiles directive. If a file is listed in both a CopyFiles-referenced and a DelFiles-referenced section, and the file is currently present on the system with a valid signature, the operating system might optimize away the copy operation but perform the delete operation. This is very likely not what the INF writer intended.
Note You cannot use a %strkey% token to specify the destination-file-name entry. For more information about %strkey% tokens, see INF Strings Section.
Setting this flag value in an INF queues the file-deletion operation until the system has restarted if the given file cannot be deleted because it is in use while this INF is being processed. Otherwise, such a file will not be deleted.
(Windows 2000 or later versions of Windows) This flag is a high-word version of the DELFLG_IN_USE flag, and it has the same purpose and effect. This flag should be used in only for installations on NT-based systems.
Setting this flag value in an INF prevents conflicts with the COPYFLG_WARN_IF_SKIP flag in an INF with both DelFiles and CopyFiles directives that reference the same file-list-section.
Important This directive must be used carefully. We highly recommend that you do not use the DelFiles directive in the INF file for a Plug and Play (PnP) function driver.
Any file-list-section name must be unique to the INF file, but it can be referenced by CopyFiles, DelFiles, or RenFiles directives elsewhere in the same INF. Such an INF-writer-defined section name must follow the general rules for defining section names. For more information about these rules, see General Syntax Rules for INF Files.
The DelFiles directive does not support decorating a file-list-section name with a system-defined platform extension (.nt, .ntx86, .ntia64, or .ntamd64).
The DestinationDirs section of the INF file controls the destination for all file-deletion operations, regardless of the section that contains a particular DelFiles directive. If a named section referenced by a DelFiles directive has a corresponding entry in the DestinationDirs section of the same INF, that entry explicitly specifies the target destination directory from which all files that are listed in the named section will be deleted. If the named section is not listed in the DestinationDirs section, Windows uses the DefaultDestDir entry in the INF.
This example shows how the DestinationDirs section specifies the path for a delete-file operation that occurs in processing a simple device-driver INF.
[DestinationDirs] DefaultDestDir = 12 ; DIRID_DRIVERS ; ... [AHA154X] CopyFiles=@AHA154x.MPD DelFiles=ASPIDEV ; defines delete-files section name ; ... some other directives and sections omitted here [ASPIDEV] VASPID.SYS ; name of file to be deleted, if it exists on target ; ...