Answered by:
Maximum Path Length Limitation

Question
-
Hi,
According to http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx. 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>". It also states that the "\\?\" prefix can also be used with paths constructed according to the universal naming convention (UNC). For example, "\\?\UNC\server\share", where "server" is the name of the computer and "share" is the name of the shared folder. I can't get the "\\?\UNC\servername\sharename" to work at all. It always comes back and say "The filename, directory name, or volume label syntax is incorrect." Can anyone help to tell me what's wrong with my syntax or this is just something doesn't work at all? Thank you!
Answers
-
I can attest to the fact that this syntax you are using does work. I just validated it using local and network paths. I received no errors when accessing paths that were correct.
Could it be that you are using certain characters in your path that are not supported.
See Article:
http://technet.microsoft.com/en-us/library/cc956689.aspx
Explanation:The system does not accept the keyboard combination Alt+0 through Alt+32 or the following characters: \\ \\ / [ ] : | < > + ; = . ? "
Visit my blog: anITKB.com, an IT Knowledge Base.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM
- Edited by Jorge Mederos Wednesday, March 3, 2010 9:26 PM
-
I quickly tested this on a Windows XP and 7 workstation. I have access to other operating systems if you need some additional testing.
I used the format exactly accorinding to your post.
For the local path, I typed \\?\C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\This is a test file with a really long name to test this path.txt
For a network path, I typed \\?\UNC\Server01\MyShare\ThisIsATestFileWithAReallyLongNameToTestThisPath.txt
Visit my blog: anITKB.com, an IT Knowledge Base.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM
- Edited by Jorge Mederos Wednesday, March 3, 2010 9:26 PM
-
Wow2009,
\\?\unc\servername\sharename\path\file.txt by itself will not work. Normally the program associated with TXT files would launch, but using this long name provider that does not work. But this is a separate issue. However, the follwing will work.
Notepad \\?\unc\servername\sharename\path\file.txt
Another Example: Notepad \\?\c:\boot.ini
All the examples everyone is giving you have COMMAND \\?\path.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM
All replies
-
I can attest to the fact that this syntax you are using does work. I just validated it using local and network paths. I received no errors when accessing paths that were correct.
Could it be that you are using certain characters in your path that are not supported.
See Article:
http://technet.microsoft.com/en-us/library/cc956689.aspx
Explanation:The system does not accept the keyboard combination Alt+0 through Alt+32 or the following characters: \\ \\ / [ ] : | < > + ; = . ? "
Visit my blog: anITKB.com, an IT Knowledge Base.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM
- Edited by Jorge Mederos Wednesday, March 3, 2010 9:26 PM
-
-
I quickly tested this on a Windows XP and 7 workstation. I have access to other operating systems if you need some additional testing.
I used the format exactly accorinding to your post.
For the local path, I typed \\?\C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\This is a test file with a really long name to test this path.txt
For a network path, I typed \\?\UNC\Server01\MyShare\ThisIsATestFileWithAReallyLongNameToTestThisPath.txt
Visit my blog: anITKB.com, an IT Knowledge Base.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM
- Edited by Jorge Mederos Wednesday, March 3, 2010 9:26 PM
-
-
The DIR command supports that with a local path. If it was allowed for a UNC path, then it would work as well if you typed "dir \\servername\sharename".
Visit my blog: anITKB.com, an IT Knowledge Base.- Edited by Jorge Mederos Wednesday, March 3, 2010 9:26 PM
-
Thanks for your input. The goal to me is trying to delete some network folders that has a very long path and name in it. When I do a "rd \\servername\share\path\folder /s", I got an error saying path too deep or something like that. I think if I can't do a "dir \\?\unc\sername\share\path" I probably won't be able to do a "rd \\?\unc\servername\share\path /s" Thanks.
-
Wow2009,
\\?\unc\servername\sharename\path\file.txt by itself will not work. Normally the program associated with TXT files would launch, but using this long name provider that does not work. But this is a separate issue. However, the follwing will work.
Notepad \\?\unc\servername\sharename\path\file.txt
Another Example: Notepad \\?\c:\boot.ini
All the examples everyone is giving you have COMMAND \\?\path.- Marked as answer by Laura ZhangMicrosoft employee, Moderator Tuesday, March 2, 2010 6:49 AM