What does \\?\ mean when prepended to a file path What does \\?\ mean when prepended to a file path windows windows

What does \\?\ mean when prepended to a file path


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

Extract:

The Windows API has many functions that also have Unicode versions topermit an extended-length path for a maximum total path length of32,767 characters. This type of path is composed of componentsseparated by backslashes, each up to the value returned in thelpMaximumComponentLength parameter of the GetVolumeInformationfunction (this value is commonly 255 characters). To specify anextended-length path, use the "\\?\" prefix. For example,"\\?\D:\very long path".

and:

The "\\?\" prefix can also be used with paths constructed according tothe universal naming convention (UNC). To specify such a path usingUNC, use the "\\?\UNC\" prefix. For example, "\\?\UNC\server\share",where "server" is the name of the computer and "share" is the name ofthe shared folder. These prefixes are not used as part of the pathitself. They indicate that the path should be passed to the systemwith minimal modification, which means that you cannot use forwardslashes to represent path separators, or a period to represent thecurrent 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.


The Windows API parses input strings for file I/O. Among other things, it translates / to \ as part of converting the name to an NT-style name, or interpreting the . and .. pseudo directories. With few exceptions, the Windows API also limits path names to 260 characters.

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.

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.