Dealing with Long File Paths

by Apr 7, 2017

Historically, the Windows file system sometimes stalls when paths grow longer than 256 characters. There is a module available at the PowerShell Gallery that adds cmdlets to quickly search the file system, and support paths of any length.

If you use PowerShell 5 or have installed PowerShellGet (www.powershellgallery.com), this is how you can download and install the “PSAlphaFS” module from the PowerShell Gallery:

 
Install-Module -Name PSAlphaFS -Scope CurrentUser 
 

Unfortunately, the cmdlets seem to require full Administrator privileges and throw exceptions for regular users. As an Administrator, you can now run commands like this to find files with critical path length:

Get-LongChildItem -Path c:\windows -Recurse -File |
  Where-Object { $_.FullName.Length -gt 250 }

Twitter This Tip! ReTweet this Tip!