Windows has a well-known limitation that restricts the maximum length of a file or folder path to 260 characters. File Explorer and many Win32 apps cannot handle file paths longer than 260 characters. Users may encounter path too long errors when trying to create, save, copy, or move files or folders with paths that exceed the maximum allowed length.
This limitation is not due to the NTFS file system but to the Win32 API, which defines the maximum path length (MAX_PATH) as 260 characters. The full path includes the drive letter (e.g., E:\), which takes up three characters; the folder path; the file name; and an invisible terminating NULL character, which takes up one character. Therefore, the real maximum length of a file or folder name is 256 characters.
A new Group Policy option that enables long path support was introduced with the release of Windows 10 (version 1607) and Windows Server 2016. This option is disabled by default. To enable long path support in Windows:
- Open the local GPO editor (
gpedit.msc) - Navigate to Computer Configuration -> Administrative Templates -> System -> Filesystem
- Enable the policy Enable Win32 long paths
- To apply this option, restart the computer.
Or, you can enable the long file path support via the registry:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
Even if you have enabled the long path support in Windows, it doesn’t guarantee that any app will correctly handle paths that exceed the default limit.
The key point is that the application must be built specifically to support long paths, and the longPathAware option must be enabled in its manifest. To verify whether a specific app supports long paths, check its manifest file for the longPathAware option. The manifest is sometimes a separate XML file stored in the application directory, but more often it is embedded within the executable (.EXE) file itself
The easiest way to explore the EXE file manifest is with the Resource Hacker tool. For example, I opened the Acrobat Reader executable file (AcroRd32.exe) in Resource Hacker. Expand the Manifest resource branch, then search the XML description for the longPathAware string. In this example, the presence of the line <ws2:longPathAware>true</ws2:longPathAware> indicates that Acrobat Reader supports long paths and will function correctly with such files once the LongPathsEnabled policy is enabled.
Long paths may still cause errors with legacy or specialized apps. Microsoft Word and other MS Office programs, for example, do not support long paths. Furthermore, Windows File Explorer still doesn’t support working with objects whose path exceeds the Win32 API’s MAX_PATH value.
To bypass the Win32 API limitation, many applications use an absolute file path with the \\?\ prefix, which is not subject to the MAX_PATH restriction. For example, the file path in this UNC format can look like this: \\?\C:\ItsVeryVeryLongPath\LongNameFile.txt
If your application doesn’t support longPathAware mode, you can use the \\?\ prefix path format to access files. This will bypass the MAX_PATH limit.
robocopy, xcopy or PowerShell.Of course, deep folder nesting and/or very long file names are bad practices that I rarely encounter nowadays. This problem usually affects users of file servers who create complex, hierarchical directory structures. An administrator can monitor maximum path lengths on file servers using scripts and address the issue through a combination of organizational and technical measures.




