Windows 10 e il limite dei 260 caratteri per il path
Come riportato nel seguente https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx i path hanno il limite dei 260 caratteri:
“In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is “D:\some 256-character path string<NUL>” where “<NUL>” represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)”
In Windows 10 Anniversary update questo limite può essere superato come riportato nel post .NET 4.6.2 and long paths on Windows 10 grazie all’introduzione della group policy Computer Enable Win32 long paths in Administrative Templates/System/File System:
Si noti che una volta applicata questa GPO non verrà rimossa se disattivata, si vedano inoltre le note nel post NET 4.6.2 and long paths on Windows 10 e in particolare le seguenti:
“After you’ve turned this on you can fire up a new instance of PowerShell and free yourself from the constraints of MAX_PATH! The key File and Directory Management APIs respect this and now allow you to skip the check for MAX_PATH without having to resort to using “\\?\” (look back to my earlier posts on path formats to understand how this works). This is also possible as PowerShell has opted into the new .NET path support (being that it is a .NET application).”
“If you look carefully at the description in the setting you’ll see “Enabling Win32 long paths will allow manifested win32 applications…“. That’s the second gate to getting support- your app must have a specific manifest setting.”
“These two gates will get you the native (Win32) support for long paths. In a managed app you’ll also need the new behavior in .NET.”
“Note that in this initial release CMD doesn’t support long paths. The Shell doesn’t add support either, but previously had limited support utilizing 8.3 filename trickery. I’ll leave it to the Windows team for any further details.”
Per maggiori informazioni si veda anche More on new .NET path handling.
La GPO Enable Win32 long paths ha sostituto la GPO Enable NTFS long paths che come riportato in questo Thread GPO: enable win32 long paths dovrebbe essere diponibile in Windows Server 2016 TP5 in attesa di essere allineata con la Enable Win32 long paths del Windows 10 Anniversary update.
Long Path Tool can help you to remove blocked files or too long path files. You can easily fix file errors with this software.