fsutil 8dot3name

查询或更改短名称(8dot3 名称)行为的设置,其中包括:

  • 查询短名称行为的当前设置。

  • 扫描指定的目录路径以查找从指定目录路径中删除短名称时可能受到影响的注册表项。

  • 更改控制短名称行为的设置。 此设置可以应用于指定的卷或默认卷设置。

  • 移除目录中所有文件的短名称。

Important

如果永久移除 8dot3 文件名而不修改指向 8dot3 文件名的注册表项,则可能会导致意外的应用程序故障,包括无法卸载应用程序。 建议你先备份目录或卷,然后再尝试移除 8dot3 文件名。

Syntax

fsutil 8dot3name [query] [<volumepath>]
fsutil 8dot3name [scan] [/s] [/l [<log file>] ] [/v] <directorypath>
fsutil 8dot3name [set] { <defaultvalue> | <volumepath> {1|0}}
fsutil 8dot3name [strip] [/t] [/s] [/f] [/l [<log file.] ] [/v] <directorypath>

Parameters

Parameter Description
查询 [<volumepath>] 查询文件系统以获取 8dot3 短名称创建行为的状态。

If a volumepath isn't specified as a parameter, the default 8dot3name creation behavior setting for all volumes is displayed.

扫描 <directorypath> Scans the files that are located in the specified directorypath for registry keys that might be impacted if 8dot3 short names were stripped from the file names.
set <setID> 以下情况下,8dot3 名称创建的文件系统行为有所更改:
  • When defaultvalue is specified, the registry key, HKLM\System\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation, is set to the defaultvalue.

    The DefaultValue can have the following values:

    • 0: Enables 8dot3 name creation for all volumes on the system.
    • 1: Disables 8dot3 name creation for all volumes on the system.
    • 2: Sets 8dot3 name creation on a per volume basis.
    • 3: Disables 8dot3 name creation for all volumes except the system volume.
  • When a volumepath is specified, the specified volumes on disk flag 8dot3name properties are set to enable 8dot3 name creation for a specified volume (0) or set to disable 8dot3 name creation on the specified volume (1).

    You must set the default file system behavior for 8dot3 name creation to the value 2 before you can enable or disable 8dot3 name creation for a specified volume.

<directorypath> Removes the 8dot3 file names for all files that are located in the specified directorypath. The 8dot3 file name is not removed for any files where the directorypath combined with the file name contains more than 260 characters.

此命令列出指向永久移除了 8dot3 文件名的文件的注册表项(但不会修改)。

<volumepath> 指定驱动器名称,后跟冒号或 GUID,格式为 volume{GUID}
/f Specifies that all files that are located in the specified directorypath have the 8dot3 file names removed even if there are registry keys that point to files using the 8dot3 file name. 在这种情况下,该操作将移除 8dot3 文件名,但不修改指向使用 8dot3 文件名的文件的任何注册表项。 Warning: It's recommended that you back up your directory or volume prior to using the /f parameter because it may lead to unexpected application failures, including the inability to uninstall programs.
/升 [<log file>] 指定写入信息的日志文件。

If the /l parameter isn't specified, all information is written to the default log file: %temp%\8dot3_removal_log@(GMT YYYY-MM-DD HH-MM-SS).log**

/s Specifies that the operation should be applied to the subdirectories of the specified directorypath.
/t 指定应在测试模式下运行 8dot3 文件名移除操作。 执行除实际移除 8dot3 文件名之外的所有操作。 可以使用测试模式来发现哪些注册表项指向使用 8dot3 文件名的文件。
/v 指定写入日志文件的所有信息也显示在命令行上。

Examples

若要查询使用 GUID {928842df-5a01-11de-a85c-806e6f6e6963} 指定的磁盘卷的禁用 8dot3 名称行为,请键入:

fsutil 8dot3name query volume{928842df-5a01-11de-a85c-806e6f6e6963}

You can also query the 8dot3 name behavior by using the behavior subcommand.

To remove 8dot3 file names in the D:\MyData directory and all subdirectories, while writing the information to the log file that is specified as mylogfile.log, type:

fsutil 8dot3name strip /l mylogfile.log /s d:\MyData