18

Possible Duplicate:
What is the longest file path that Windows can handle?

Does anybody know if it is possible to extend the maximum path length in Windows 7 (64-bit)?

0

3 Answers 3

21

Unfortunately the answer is "depends on the program". It is up to the people who write the programs to determine which method they want to use. In fact, (shameless plug) I wrote a blog entry a few weeks ago describing the problem at Explorer still limited by MAX_PATH.

Depending on what you're trying to do you could use another program to manage the long paths, like Microsoft Word. Otherwise, your only other option is to just "live with it" since it's been like that forever and doesn't seem to be changing anytime soon.

Just thought I'd also mention that 64-bit Windows also uses the "Win32" API and CreateFileA for both 32-bit and 64-bit programs have the problem.


EDIT: Geeky Details

The problem exists only in the CreateFileA function and the CreateFileW function when an absolute path with a drive letter is used. The only method to get around it (in code) is to use the \\?\C:\Path\To\File.txt syntax... so even programs that use CreateFileW with a path of C:\Path\To\File.txt have the issue. It's kind of hard to describe but needless to say, the largest reason of programs not internally supporting the \\?\ syntax is they loose the ability to use relative paths (paths like ..\Documents\file.doc).

4
  • Sigh Yes, I was using Windows Explorer. It seems odd to me because I was usually able to create extremely long file paths in Windows XP without trouble (I never got the long path error in XP. Not once!). Oh well
    – Cameron
    Sep 8, 2009 at 13:29
  • 2
    Yeah, there are varying ways to get around the issue, none of them seem to work 100% though. Honestly I find the problem to be a huge issue since we're keeping more and more files. It really gets me when Word can save to a long path just fine, but when you use explorer to copy it dies with a "The path name is too long for the destination"
    – Joshua
    Sep 8, 2009 at 13:32
  • Thanks for the "geeky details", they're very interesting (and somewhat make sense) to me because I am a student programmer (I haven't really used the Win32 API yet though)
    – Cameron
    Sep 10, 2009 at 13:08
  • Funny, I got that long path error all the time in XP/2003.
    – surfasb
    Jul 19, 2011 at 7:24
7

The SUBST command which is included in Windows 7 will allow access to a longer path via the new virtual drive letter.

Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]

SUBST drive1: /D

drive1: Specifies a virtual drive to which you want to assign a path.

[drive2:]path Specifies a physical drive and path you want to assign to a virtual drive.

/D Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

2

Use a Junction Point to provide a shorter path into a longer path.

Not the answer you're looking for? Browse other questions tagged .