Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Overriding MAX_PATH

16 May 2013   #1

Windows 7 Home Premium 64-bit
Overriding MAX_PATH

MAX_PATH is the 260 character limit Windows places on file paths. Apparently the NTFS file path limit is 32,767 characters, and since Windows uses that file system, I'm not sure what the massive restriction is for. Whenever I transfer files between hard drives of different file systems, this bloody MAX_PATH variable seems to happily get in the way, if only by a few characters. And to make matters worse, although Windows tells you about the names of the several hundred or so files that didn't quite make the transfer due to their paths being over 260 characters, it doesn't have the courtesy to tell you where exactly those files are.

Since I expect I will continue transferring files in the near future, I have started taking a look at what is out there to override MAX_PATH. So far I have heard of Robocopy and I shall have a more in-depth look at it soon. I expect that there are also other solutions out there and that people here have attempted them, so before I commit too much to one solution that might not necessarily be the best one, it would be great to hear of any viable alternatives. Ideally there would be something that could be done "in-house", i.e. without having to rely on third-party software, to override MAX_PATH, but I'm not expecting miracles.

Also, if anyone knows of any way to obtain a record of the paths of any files that encountered errors during transfers and thereby possibly didn't get transferred, your input on this would also be appreciated.

Thank you for any help.

My System SpecsSystem Spec
16 May 2013   #2

Windows 7 Home Premium 64-bit

Quote   Quote: Originally Posted by logicearth View Post
Just use Robocopy as it was designed for what you want. Its built into Windows 7 so its not third-party well in terms of Windows. Furthermore, the 255 limit is an NTFS limit. I don't know where you got 32,767 but that is not it.
That's what I thought, but some people on Wikipedia seem to think otherwise. Best not to use an encyclopedia run by the public, as they say.

It's great that Robocopy is built in. I'll try it out after my current transfer is finished.
My System SpecsSystem Spec
16 May 2013   #3

Windows 10 Pro (x64)

Misunderstanding on my part in the first post, however it still stands, use robocopy.

This is probably the infromation that you want:
Naming Files, Paths, and Namespaces (Windows)
Maximum Path Length Limitation

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

Note File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\\?\" prefix. For example, "\\?\D:\very long path".

Note The maximum path of 32,767 characters is approximate, because the "\\?\" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.
My System SpecsSystem Spec

16 May 2013   #4

Windows 7 Ultimate x64

MAX_PATH isn't a parameter you can modify with some obscure registry technique, but rather is a constant defined in the Win32API C header files. The value comes from a limitation in the Windows API itself, as many file-handling functions take this value as the maximum allowable path length, so further folders would be truncated and programs react by preventing generating them in the first place. While the NTFS filesystem does allow longer paths, Windows itself cannot handle them correctly sometimes (I guess for compatibility reasons).
My System SpecsSystem Spec
17 May 2013   #5

Windows 7 Pro 64 bit

The NTFS file system has a maximum path limit of 32767 bytes. But you can only realize that if the software you are using doesn't impose a lower limit. As it turns out, many system functions and software do impose a lower limit of MAX_PATH. Changing this value is so close to impossible as to not matter.

At this point in time Microsoft can't change the value of MAX_PATH. Doing so would break an enormous amount of existing software.

You have 2 choices:
1. Use file copying software, such as Robocopy, that does not have the MAX_PATH limit. This will allow you to copy files with a long path but that won't help with software that recognizes this limit.
2. Keep path lengths within the limit.
My System SpecsSystem Spec
03 Aug 2013   #6

Windows 7 Home Premium 64-bit
Bypass MAX_PATH using drag-and-drop?

robocopy works, but I wish there were some way to bypass max_path from startup using built-in drag-and-drop instead of having to start a program in admin mode and double-check precise commands. It might be fine for the occasional backup but when every other move is affected it starts getting annoying.
My System SpecsSystem Spec

 Overriding MAX_PATH

Thread Tools

Similar help and support threads
Thread Forum
How modify win explorer's limit of Win API (max_path = 260 signs) ?
When I was copying files to external HDD as backup, I faced error of long file paths. I was unable to copy them. Both (my pc and external HDD) has NTFS file system. So it's clearly problem of that explorer. How may I modify or patch it please ? I plan to do sync backup of my data every week,...
General Discussion
Is there another key that could be overriding it?
I used the ShellMenuView utility to find the registry keys associated with the .js extension and changed this key: HKEY_CLASSES_ROOT\JSFile\Shell\Edit\Command from a path to notepad.exe to the notepad++.exe path. For some reason though the edit context menu still opens with notepad. I did...
Mom Needs Help with Teenager overriding Password
Hi There! I was just wandering if anyone could help me with a problem. My 16 year old daughter has watched a video on you tube on how to override the password I have on windows so she can get into the computer. She actually is able to find out what all the passwords are even though I clear the...
General Discussion
Windows overriding software preferences
Hi. First of all I did not know where to put this thread. I figured this would be the most suiting sub-forum for it. Secondly I couldn't come up with a good thread title, sorry about that. Here's my problem: When I use Starcraft 2 Editor I can go into Preferences and change stuff like...
General Discussion
Sound Flux/Overriding
Hello all. I have recently purchased my computer through Dell, just this past Friday it had arrived. Specs: Operating System:Windows (Win 7, 64-bit) CPU Type:AMD Phenom(tm) II X6 1035T Processor CPU Speed (GHz):2.62 System Memory (GB):4 Sound Card: ATI High Definition Audio...
Sound & Audio

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 16:24.
Twitter Facebook Google+