INF RenFiles 指令

注意

如果要生成通用或 Windows 驱动程序包,则此指令无效。 请参阅在 Windows 驱动程序中使用通用 INF 文件和入门。

RenFiles 指令引用 INF 文件中其他位置的 INF 编写器定义的节,这会导致在指定引用 RenFiles 指令的节的操作上下文中重命名该文件列表。

[DDInstall] | 
[DDInstall.CoInstallers] | 
[ClassInstall32] | 
[ClassInstall32.ntx86] | 
[ClassInstall32.ntia64] | (Windows XP and later versions of Windows)
[ClassInstall32.ntamd64] | (Windows XP and later versions of Windows)
[ClassInstall32.ntarm] | (Windows 8 and later versions of Windows)
[ClassInstall32.ntarm64] (Windows 10 version 1709 and later versions of Windows)

Renfiles=file-list-section[,file-list-section]...

可以在形式语法语句中显示的任何部分中指定 RenFiles 指令。 还可以在以下任何 INF 编写器定义的部分中指定此指令:

RenFiles 指令引用的每个命名节都有一个或多个以下形式的条目:

[file-list-section]
 
new-dest-file-name,old-source-file-name 
...

file-list-section 可以包含任意数量的条目,每个条目位于单独的行上。

new-dest-file-name
指定要提供给目标上的文件的新名称。

old-source-file-name
指定文件的旧名称。

注解

重要

必须谨慎使用此指令。 强烈建议不要将 INF 文件中的 RenFiles 指令用于即插即用 (PnP) 函数驱动程序。

任何 file-list-section 名称对于 INF 文件必须是唯一的,但它可由同一 INF 中的其他位置的 CopyFilesDelFilesRenFiles 指令引用。 此类 INF 编写器定义的节名称必须遵循定义节名称的一般规则。 有关这些规则的详细信息,请参阅 INF 文件的一般语法规则

RenFiles 指令不支持使用系统定义的平台扩展名 (.ntx86、.ntia64、.ntamd64.ntarm.ntarm64) 修饰文件列表节名称。

INF 文件的 DestinationDirs 部分控制所有文件重命名操作的目标,而不考虑包含特定 RenFiles 指令的节。 以下规则描述了文件重命名操作:

  • 如果 RenFiles 指令引用的命名节在同一 INF 的 DestinationDirs 节中具有相应的条目,则该条目将显式指定目标目录。 在复制这些源文件之前,将在目标上重命名命名节中列出的所有文件。

  • 如果已命名节未在 DestinationDirs 部分列出,Windows 将使用 INF 的 DestinationDirs 节中的 DefaultDestDir 条目。

注意

不能使用 %strkey% 令牌指定新的或旧的文件名。 有关 %strkey% 令牌的详细信息,请参阅 INF 字符串部分

示例

此示例演示 RenFiles 指令引用的节。

[RenameOldFilesSec]
devfile41.sav, devfile41.sys

另请参阅

AddInterface

ClassInstall32

CopyFiles

DDInstall

DelFiles

DestinationDirs

InterfaceInstall32

SourceDisksFiles

SourceDisksNames

字符串

版本