How to enable NTFS Long Paths in Windows 10

解决源文件名长度大于文件系统支持的长度问题

In Windows 10 Anniversary Update, Microsoft finally addressed a long-standing issue that developers faced while doing development – the 260 character limitation for path length. This path length limitation was present in Windows for almost an eternity. In case you don’t know, in all currently released Windows versions, the maximal length of the file path is 260 chars. Starting with build 14352 of Windows 10, which is part of the Anniversary Update (version 1607), this limitation can be bypassed.

All Windows file systems have a concept of files and folders to access stored data. A path is a string value that indicates where that data is stored. However, there is a limitation of 260 characters for the path imposed by Windows, which includes the drive letter, colon, separating backslashes and a terminating null character. This is not a limitation of the NTFS file system but of the legacy APIs that are used to access data. There are also workarounds like accessing the Unicode (or “wide”) versions of the Windows API functions, and also by prefixing the path with \\?\.

At the end user level, some users might have already faced the issue in the past, when File Explorer doesn’t allow access to a file or a folder, if the path to it exceeds 260 chars. In such a situation, the user has no other solution but to either use symbolic links to access that data or a third party tool which uses workarounds. For example, the alternative file management tool, Total Commander can help you access such files and folders, since it is able to work with long paths out of the box.

However, the Explorer Shell still has had this limitation in Windows for years. To resolve this issue, Microsoft has made the appropriate changes in Windows 10. A new Group Policy setting, available starting with Windows 10 build 14352, will allow the operating system to have paths longer than 260 chars:

Enabling NTFS long paths will allow manifested Win32 applications and Windows Store applications to access paths beyond the normal 260 char limit per node. Enabling this setting will cause the long paths to be accessible within the process.

This actually means that an application has to have the following line in its manifest:

A manifest is a small file that contains additional information about the process EXE such as compatibility information and DPI-awareness etc.

Besides the app developer adding the manifest, the appropriate Group Policy setting should be enabled. This can be done using Group Policy Editor or by using a Registry tweak.

How to enable NTFS Long Paths in Windows 10 using Group Policy

  1. Press Win + R keys together on your keyboard and type:

    Press Enter.
  2. Group Policy Editor will open. Go to Local Computer Policy -> Computer Configuration -> Administrative Templates -> System -> Filesystem -> NTFS.
  3. There, double click and enable the option Enable NTFS long paths.
  4. Restart Windows 10.

How to enable NTFS Long Paths in Windows 10 using a Group Policy tweak

  1. Open Registry Editor.
  2. Go to the following Registry key:

    Tip: You can access the desired Registry key with one click.
    If you don’t have such a key, then just create it.
  3. On the right side, create a new 32-bit DWORD value named LongPathsEnabled. Set its value data to 1.

    Note: Even if you are running 64-bit Windows, you still need to create a 32-bit DWORD value. See the following screenshot:
  4. Restart Windows 10.

Finally, there is a way to enable this new feature without using Group Policy. It requires the following tweak.

How to enable NTFS Long Paths in Windows 10 using a Registry tweak

  1. Open Registry Editor.
  2. Go to the following Registry key:

    Tip: You can access the desired Registry key with one click.
    If you don’t have such a key, then just create it.
  3. On the right side, create a new 32-bit DWORD value named LongPathsEnabled. Set its value data to 1.
  4. Restart Windows 10.

You are done.

发表评论

电子邮件地址不会被公开。 必填项已用*标注