How can I use path names longer than 255 characters?

John Savill

May 9, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Windows NT has a maximum path size defined as MAX_PATH which is255 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 usepaths that are nearly 32,000 Unicode characters long. You must usefully-qualified paths with this technique. This also works with UNC names.

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

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

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

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like