Path too long
July 21, 2021
Powershell error "Get-ChildItem : Could not find ax part of the path" happens when the path has reached 260 characters.
Remedies
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.
To enable the new long path behavior, both of the following conditions must be met:
- The registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
(Type: REG_DWORD) must exist and be set to 1. The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). 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.
From <https://docs.microsoft.com/en-ca/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd>