Subscribe to Windows IT Pro
May 10, 1999 12:00 AM

How can I use path names longer than 255 characters?

Windows IT Pro
InstantDoc ID #14607
Rating: (1)

A. Windows NT has a maximum path size defined as MAX_PATH which is 255 characters. It is possible to use more characters by calling the wide (W) version of CreateFile and prefixing "\\?\" to the path. The "\\?\" tells the function to turn off path parsing. This lets you use paths that are nearly 32,000 Unicode characters long. You must use fully-qualified paths with this technique. This also works with UNC names.

The "\\?\" is ignored as part of the path.

For example, "\\?\D:\documents\faq.txt" is seen as "D:\documents\faq.txt".

Programs expecting to find legal file lengths may fall over attempting to open a file with a long path. If, for example the buffer they are putting the path into expects a legal file length.


Related Content:

ARTICLE TOOLS

Comments
  • Ta
    4 years ago
    Aug 15, 2008

    Hi!
    How can I rename the file in the long path to normal and else? I type "ren C:\\test.txt \\\\?\\C:\\test1.txt" in Command Prompt and see the message "The syntax of the command is incorrect.". How I do? :(

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.