Reputation: 7305
As specified here it is possible to use absolute paths on Windows without the MAX_PATH
length limitation.
However I noticed paths starting with \\?\
don't work in certain older versions of Windows.
Which version do I need to detect (e.g. with one of the functions described here) to help my software decide on using \\?\
paths?
Upvotes: 0
Views: 2540
Reputation: 331
fun is, starting Windows 10 Version 1607, you can opt-in to remove the MAX_PATH limitation in your system globally without any prefix:
https://learn.microsoft.com/de-de/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
Upvotes: 0
Reputation: 33774
if you use \\?\
prefix in unicode path - the long paths is always supported in any version of windows (even win2000 and xp). question about support long paths - only affect another path types, which not begin with \\?\
, such as c:\*
from Maximum Path Length Limitation
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. ... To specify an extended-length path, use the
"\\?\"
prefix. For example,"\\?\D:\very long path"
.
usual on any individual function documentation direct stated about \\?\
prefix too (if it supported by this api - File I/O functions always support this prefix, when shell api - never)
for instance from GetFileAttributesW
To extend this limit to 32,767 wide characters, call the Unicode version of the function (GetFileAttributesW), and prepend
"\\?\"
to the path.
the same on CreateFileW
and so on..
To extend this limit to 32,767 wide characters, use this Unicode version of the function and prepend
"\\?\"
to the path.
Upvotes: 1