Quickly produce a list of long file path names.

Here is a quick and easy way to produce a list of long path names from a PS prompt. dir has severation options. File is output in current path as txt file (no sorting).

  1. Run PowerShell (As Admin)
  2. Navigate to folder like C:\Users\Daniel
  3. Run the below

Longer than 260 Characters

cmd /c dir /s /b |? {$_.length -gt 260} > longfilenames.txt

Longer than 150 Characters

cmd /c dir /s /b |? {$_.length -gt 150} > longfilenames.txt

System File Checker

Sometimes files get corrupted

System File checker needs an CMD (Administrator) prompt to run

sfc /scannow

When running outside of windows in a recovery or system restore environment (WinPE) the location of the windows folder must be specified.

Just remember to check the drive letters!

sfc /scannow /offbootdir=C:\ /offwindir=C:\windows