Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Maximum Path Length - Windows 2000, XP, 2003

Posted on 2004-08-12
Medium Priority
Last Modified: 2012-06-22
I have a large file system and am having difficulties with deeper folder levels hitting the maximum path length.  I have seen article talking about the "\\?\" prefix to enable 32,000+ characters, rather than the standard ~255.  I do not know if this can be applied.
I need to use Windows File System normally (i.e. Explorer - via GUI), but with long paths.  Is there any setting (anything else?) that will allow for this?
Thanks if someone can advise...
Question by:DevelopHer
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 20

Expert Comment

ID: 11784676
In the Windows API, the maximum length for a path is MAX_PATH, which is defined as 260 characters. A path is structured as follows: drive letter, colon, backslash, components separated by backslashes, and a null-terminating character. For example, the maximum path on the D drive is D:\<256 chars>NUL.

The Unicode versions of several functions permit a maximum path length of 32,767 characters, composed of components up to 255 characters in length. To specify such a path, use the "\\?\" prefix. For example, "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" prefix. For example, "\\?\UNC\<server>\<share>". Note that 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. An implication of this is that you cannot use forward slashes to represent path separators or a period to represent the current directory. Note also that you cannot use the "\\?\" prefix with a relative path. Therefore, relative paths are limited to MAX_PATH characters.

When using the API to create a directory, the specified path cannot be so long that you could not append an 8.3 file name.

Note that the shell and the file system may have different requirements. It may be possible to create a path with the API that the shell UI cannot handle.

Author Comment

ID: 11784865
The comment from DVation191 does not help me.  I have read it before (it was pasted here from another thread).  If the "\\?\" prefix is a possibility, I need to know HOW to implement this on an existing file system.  How, where, when do I use the "\\?\" prefix, if this is the answer?
LVL 20

Expert Comment

ID: 11785158
Well I didn't copy and paste from another thread...i got it right from the msdn article at the bottom of the post if it makes any difference.
Unfortunately I am not a programmer and have no idea how to use the Windows API to reference a path using the specified prefix. As far as I can tell, being that this functionality is part of the Windows API, it cannot be changed by any means in the Explorer gui.
It does state however, "It may be possible to create a path with the API that the shell UI cannot handle."...of course MS gave no reference to what that possibility might be...sorry DevelopHer

Accepted Solution

catknows earned 1000 total points
ID: 11858013
Using the windows GUI, I don't think you would ever be able to create any filename whole length can be longer than 260 characters (path+filename altogether).

The answer is NO. For sure.  Unless Windows Explorer is rewritten with that capability, either by MS, a third party software or you yourself.
LVL 20

Expert Comment

ID: 13573817
Just because you didn't like the answer doesn't mean you should give somebody a "C". Even still, I mentioned the 260 character limit first, which means you accepted the wrong answer anyway.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question