I need to be able to create a path structure that is longer than 260 characters on a Windows Server 2016 system.
After thoroughly reading through various sources, I understand that Windows Server 2016, version 1607 should support long paths.
I activated the respective local group policy setting (Computer Config -> Administrative Templates -> System -> Filesystem -> Enable Win32 long paths) and I verified that the registry key was changed appropriately (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem -- LongPathsEnabled set to 0x1).
I restarted the system and in order to verify that long paths are now working. According to GPRESULT.EXE, the policy is set correctly.
So, again I tried, within Powershell, to create a long path name just right within my user profile folder. Unfortunately, still no luck, I keep seeing the error message:
New-Item : The specified path, file name, or both are too long. The fully qualified file name must
characters, and the directory name must be less than 248 characters.
At line:1 char:1
+ New-Item -Type Directory $longdir
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Users\myUser...adföklasdfjölkj:String) [New-Item], Pa
+ FullyQualifiedErrorId : CreateDirectoryIOError,Microsoft.PowerShell.Commands.NewItemCommand
I even verified the manifest of Powershell.exe and can confirm that Long Paths are enabled.
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
It all seems right and still I am not able to create file paths longer than 260 characters.
By the way, I did the exact same things on another system and everything works there. Just that this other system is my own system and the system where I have problems is the client's system.
Any idea what else I could try here?
Most relevant official sources:
- https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
- https://docs.microsoft.com/en-us/archive/blogs/jeremykuhne/net-4-6-2-and-long-paths-on-windows-10
Update
About 4-5 hours after having configured the system in the way described above, it simply just worked. I didn't change my testing procedures, I didn't change any settings, I didn't reboot again, it just worked all of a sudden. If anyone has an explanation for this, I'd be very interested to read it. I'm baffled.