Why does the 260 character path length limit exist in Windows?

后端 未结 11 1211
孤城傲影
孤城傲影 2020-11-22 03:18

I have come up against this problem a few times at inopportune moments:

  • Trying to work on open source Java projects with deep paths
  • Storing deep Fitne
11条回答
  •  生来不讨喜
    2020-11-22 03:39

    From Windows 10. you can remove the limitation by modifying a registry key.

    Tip Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

    A registry key allows you to enable or disable the new long path behavior. To enable long path behavior set the registry key at HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD). The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (list follows). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set. The registry key can also be controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths. You can also enable the new long path behavior per app via the manifest:

    
        
            true
        
    
    

提交回复
热议问题