Window 256 characters path name limitation

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


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.

Source