views:

3168

answers:

5

As I understand it, the limitation of 255 characters in a file path is a Windows limitation. What is the reasoning for this? If so, has this been resolved in Windows 7?

In our continuous integration practices, we often have deeply nested project structures and it would be extremely useful to be able to go beyond 255 characters. Right now we are somewhat forced to structure our projects in such a way as to not hit this artificial ceiling.

+2  A: 

You can get around that limit by using subst if you need to.

Joshua
+8  A: 

See http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx

This explains that Unicode versions of Windows APIs have higher limits, and how to enable that.

Drew Hoskins
But a word of warning: There's a bunch of code (mostly 3rd party system utilities and the like) that doesn't play well with longer paths. You may have issues with that if you start using longer paths.
Larry Osterman
+2  A: 

Don't know if it's been fixed in Windows 7, but as for this question:

What is the reasoning for this?

The answer likely has to do with the use of Pascal style strings where the first byte of the string stores the length. These strings are faster to manipulate due to the fact that you don't have to search the string for the null terminator to determine its length like you do with C-style strings. Consequently they were popular in many early windows programs (Excel for example, and probably explorer and various other scattered pieces of windows). The problem of course is that a byte can only hold values up to 255, so you can't have strings longer than that.

You can still see remnants of this stuff scattered throughout the windows API. For example the old 16 bit LoadModule function's lpCmdLine. If paths longer than 255 characters were allowed, it could cause programs that use those functions to fail miserably, breaking backwards compatibility.

Eric Petroelje
This is not correct, win32 uses C style strings (Kernel and COM uses counted strings, but the count is 16 or 32 bit) I'm guessing this limit comes from using TCHAR path[MAX_PATH]; in several places
Anders
A: 

Limitation of file path with 255 characters are blocking my work. It's highly important for me to get around this problem. I'm not also use to communicating via these pages so can someone drop me a solution message to typcyp at gmail.com ?!

Thank you for your concern,

Regards - Typhoon

TYPHOON CYPRIAN
A: 

I'm am having the same problem on my a Dell Win7 Pro 64bit CAD machine. We have large complex directories for our cad drawings and windows 7 will not let us use directories that are more than 255 characters. It is forcing me to shorten or move each folder so it's path doesn't exceed 255 characters. We didn't have this problem with Vista 64 and XP.

Doron