简体   繁体   English

\\\\?\\ 在文件路径前面是什么意思

[英]What does \\?\ mean when prepended to a file path

I found a reference to a file in a log that had the following format:我在具有以下格式的日志中找到了对文件的引用:

\\?\C:\Path\path\file.log

I cannot find a reference to what the sequence of \\?\\ means.我找不到对 \\?\\ 序列含义的引用。 I believe the part between the backslashes refers to a hostname.我相信反斜杠之间的部分是指主机名。

For instance, on my Windows computer, the following works just fine:例如,在我的 Windows 计算机上,以下工作正常:

dir \\?\C:\

and also, just fine with same result:而且,同样的结果就好了:

dir \\.\C:\

Questions:问题:

  1. Is there a reference to what the question mark means in this particular path format?问号在此特定路径格式中的含义是否有参考?
  2. What might generate a file path in such a format?什么可能生成这种格式的文件路径?

A long read, but worth reading if you are in this domain: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx长篇阅读,但如果您在此域中,则值得一读: http : //msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

Extract:提炼:

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. Windows API 有许多函数,这些函数也有 Unicode 版本,以允许最大总路径长度为 32,767 个字符的扩展长度路径。 This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters).此类路径由以反斜杠分隔的组件组成,每个组件最多为GetVolumeInformation函数的lpMaximumComponentLength参数中返回的值(该值通常为 255 个字符)。 To specify an extended-length path, use the "\\\\?\\" prefix.要指定扩展长度的路径,请使用"\\\\?\\"前缀。 For example, "\\\\?\\D:\\very long path" .例如, "\\\\?\\D:\\very long path"

and:和:

The "\\\\?\\" prefix can also be used with paths constructed according to the universal naming convention (UNC). "\\\\?\\"前缀也可用于根据通用命名约定 (UNC) 构造的路径。 To specify such a path using UNC, use the "\\\\?\\UNC\\" prefix.要使用 UNC 指定这样的路径,请使用"\\\\?\\UNC\\"前缀。 For example, "\\\\?\\UNC\\server\\share" , where "server" is the name of the computer and "share" is the name of the shared folder.例如, "\\\\?\\UNC\\server\\share" ,其中"server"是计算机的名称,而"share"是共享文件夹的名称。 These prefixes are not used as part of the path itself.这些前缀不用作路径本身的一部分。 They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory.它们表示路径应该以最少的修改传递给系统,这意味着您不能使用正斜杠表示路径分隔符,或使用句点表示当前目录,或使用双点表示父目录。 Because you cannot use the "\\\\?\\" prefix with a relative path, relative paths are always limited to a total of MAX_PATH characters.因为不能在相对路径中使用"\\\\?\\"前缀,所以相对路径总是限制为总共MAX_PATH字符。

The Windows API parses input strings for file I/O. Windows API 解析文件 I/O 的输入字符串。 Among other things, it translates / to \\ as part of converting the name to an NT-style name, or interpreting the .除此之外,它将/转换为\\作为将名称转换为 NT 样式名称或解释. and .. pseudo directories...伪目录。 With few exceptions, the Windows API also limits path names to 260 characters.除了少数例外,Windows API 还将路径名限制为 260 个字符。

The documented purpose of the \\\\?\\ prefix is: \\\\?\\前缀的记录目的是:

For file I/O, the "\\\\?\\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system.对于文件 I/O,路径字符串的“\\\\?\\”前缀告诉 Windows API 禁用所有字符串解析并将其后的字符串直接发送到文件系统。

This allows the use of .这允许使用. or .. in path names, as well as relaxing the 260 character path name limit, if the underlying file system supports long paths and file names...在路径名中,以及放宽 260 个字符的路径名限制,如果底层文件系统支持长路径和文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM