Note If you are building a universal or mobile driver package, this directive is not valid. See Using a Universal INF File.
A RenFiles directive references an INF-writer-defined section elsewhere in the INF file, which causes that list of files to be renamed in the context of operations on the section in which the referring RenFiles 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) Renfiles=file-list-section[,file-list-section]...
A RenFiles 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 RenFiles directive has one or more entries of the following form:
[file-list-section] new-dest-file-name,old-source-file-name ...
A file-list-section can have any number of entries, each on a separate line.
Important This directive must be used carefully. We highly recommend that you do not use the RenFiles 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 RenFiles 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-rename operations, regardless of the section that contains a particular RenFiles directive. The following rules describe the file-rename operation:
- If a named section referenced by a RenFiles directive has a corresponding entry in the DestinationDirs section in the same INF, that entry explicitly specifies the target destination directory. All files that are listed in the named section are renamed on the destination before these source files are copied.
- If a named section is not listed in the DestinationDirs section, Windows uses the DefaultDestDir entry in the DestinationDirs section of the INF.
Note You cannot use a %strkey% token to specify the new or old file names. For more information about %strkey% tokens, see INF Strings Section.
This example shows a section referenced by a RenFiles directive.
[RenameOldFilesSec] devfile41.sav, devfile41.sys