Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the longest file path that Windows can handle?

share|improve this question
1  
I found the answer via google but thought I would import the answer and question into super user. – Ron Tuffin Jul 29 '09 at 8:07

2 Answers

up vote 25 down vote accepted

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.)

share|improve this answer
+1 It's stupid how people don't bother to upvote dead-easy yet just as important questions – Ivo Flipse Jul 29 '09 at 8:21
2  
You should mention that you can handle paths that exceed this limit by prefixing it with `\\?` (I think it was that character sequence). – Joey Jul 29 '09 at 8:54
2  
This is very high on my top-two things I hate about windows... – JesperE Jul 29 '09 at 17:37
1  
you should also state the limit for unicode-paths mentioned in the 2nd paragraph: ~32k – akira Sep 28 '09 at 15:29
260? 256 characters ignoring drive:\ and terminator. It's 2009, why do we only get a byte of characters to play around with? – Phoshi Oct 11 '09 at 16:57
show 1 more comment

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

share|improve this answer
this is just true if you dont use the unicode-api, which extends the limit a bit (~32k, see msdn.microsoft.com/en-us/library/…) – akira Sep 28 '09 at 15:30
hmmm. at that rate, the limit in Win7 ought to be around 265 characters, no? – quack quixote Oct 11 '09 at 16:54
Why would they increase the limit by ten characters? Doesn't seem worth it, does it :\ – Phoshi Oct 11 '09 at 16:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.