Answered Maximum Path Length Limitation

  • Wednesday, February 17, 2010 11:04 PM
     
     
    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!

All Replies

  • Thursday, February 18, 2010 2:09 AM
     
     Answered

    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.
  • Monday, February 22, 2010 10:33 PM
     
     
    Hi,
    Can you tell me what client OS and server OS you are running this command on?  I have tested both the local and network paths, only the local path works.  Can you provide me an example of the network path you test?  Thank you.
  • Monday, February 22, 2010 11:41 PM
     
     Answered
    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.
  • Wednesday, February 24, 2010 8:39 PM
     
     
    Hi,
    Okay, I can type "type \\?\unc\servername\sharename\path\file.txt".  I guess what I don't understand is why I can't do a directory list like "dir \\?\unc\servername\share\path" for a network path.  It works fine with a local pth.  Thanks again.
  • Thursday, February 25, 2010 12:35 AM
     
     
    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 [JorgeM] Wednesday, March 03, 2010 9:26 PM
    •  
  • Thursday, February 25, 2010 9:31 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.
  • Thursday, February 25, 2010 9:55 PM
     
     Answered
    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.