What is the longest file path that Windows can handle?

Maximum Path Length (from MSDN)

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\<some 256 character path string><NUL>" where "<NUL>" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)


XP file path- 250 characters

Vista file path - 260 characters

The longest path on a clean install of Windows XP is 152 characters.

The longest path on a semi-clean install of Windows Vista is 195 characters:

Windows XP allows file names upto 255 characters in length

Windows Vista allows even longer filenames containing upto 260 characters.

http://www.codinghorror.com/blog/archives/000729.html


Windows constant MAX_PATH is equal to 260 as other answers says, however, the real longest path is 32767.

See here.

32k is while using UNICODE, but now we must use it, so we should also use such max path length.

Also, you can take a look into my answer in SO which explains some things more detailed about maximum path length.

Tags:

Windows

Path