after a long research, I finally found out that pathnames cannot be longer than 256 characters even in the latest Microsoft Windows 7. I really don't get it why there is such a stupid limitation, since NTFS can handle up to ~32,000 characters path length without any problem since more than a dozen years! Isn't there any possibility to change that? Or are there any practical solutions to avoid that?

260 characters are just very few for even simple use cases like some nested photo directories with long file names.

  • 2
    I think the worry is that there are older programs that have a hardcoded idea of how long a path should be, so that if you try to use them on longer paths, they will explode in interesting ways.
    – dsolimano
    Jul 23, 2010 at 15:37
  • Do Linux OS's have this problem?
    – ahorn
    Nov 29, 2019 at 10:47
  • just for the record, on Win10 one can now remove that limitation - docs.microsoft.com/el-gr/archive/blogs/jeremykuhne/… Jul 1, 2020 at 15:58

3 Answers 3


According to Microsoft:

  • The traditional Windows API limits path names to 260 characters, even for applications developed for the latest version.

  • Applications using the Unicode-aware API can use a form of path that allows up to 32767 characters. The file name has to be prefixed with \\?\, and must be an absolute path, e.g., \\?\c:\dir\file or \\?\UNC\server\share\file. There are further limitations, see the reference for details.

If you've managed to create and use a deep file hierarchy and need to work with an application that bombs out because of file name length, there are a few things you can try:

  • Use the mklink command to create symbolic links, and pass a path that uses them to your application.

  • Use the subst command to assign a drive letter to a directory.

  • Start your application from a deep directory and pass it short relative paths.

  • Replace some long names by their 8.3 aliases (micros~1), assuming those still exist in Windows 7. If you have micros~1 alongside micros~2, I don't know how to tell which is which; perhaps run DOS command.com (again, assuming Windows 7 can still do it).

  • 3
    Well, even the Windows Explorer from Win7 seems to use the traditional API! That's a pity.
    – nils
    Jul 25, 2010 at 11:59
  • 4
    Even more backslashes `\\?\` :-)
    – Déjà vu
    Aug 31, 2010 at 17:39
  • @Gilles, Is micros~1 and micros~2 standardized throughout systems or is it random?
    – Pacerier
    Feb 28, 2017 at 4:12
  • @Pacerier Whichever directory was created first gets micros~1, so it's essentially random. Feb 28, 2017 at 9:32

You could use the short (8.3) names for all your folders and files.

You need to make sure that they're enabled though.

A long file name is considered to be any file name that exceeds the short MS-DOS (also called 8.3) style naming convention. Typically, Windows stores long file names on disk as special directory entries, which can be disabled systemwide for performance reasons depending on the particular file system. When you create a long file name, Windows may also create a short 8.3 form of the name, called the 8.3 alias, and store it on disk also. This 8.3 aliasing can be disabled for a specified volume.

(my bold)

You'll also have to write some code to get the short name from the long name.


  • 2
    lol... I can well remember these days in Windows 95 when we all got this super duper FAT32 with 256 chars long filenames! That was fantastic (at these days) and I'm really shocked that file name limitations could still be an issue in these days. 2010! Windows is really archaic...
    – nils
    Jul 23, 2010 at 14:25
  • Ten years after and still an issue. But when we know that this is a contract that cause very old Win32 Apps running today in windows 10 64 bits, really archaic may be changed for what a trade-off Dec 23, 2020 at 20:15

The file/directory name in NTFS is limited to 255 unicode codepoints, since the length is stored as a byte. But there is no inherent limit of the total path length.

Many Win32 API calls (including explorer shell) calls do have the 260 - 1 length limit. Some other calls have the ability to use the \\?\ prefix to get up to 32K (a bit less, since the volume name gets substitued in Kernel-land)

You must log in to answer this question.