Actions

Difference between revisions of "Powershell: Long File Names"

From Rabbi Blog

(Created page with "Sometimes knowing ahead of time that long file names are present is helpful. Example code ------------ <pre> $maxlength = 214 $longfilelist = cmd /c dir "C:\windows\" /s /...")
(No difference)

Revision as of 06:27, 25 September 2019

Sometimes knowing ahead of time that long file names are present is helpful.

Example code


$maxlength = 214
$longfilelist = cmd /c dir "C:\windows\" /s /b |? {$_.length -gt $maxlength}

foreach ($longfile in $longfilelist) {
    $filelength=$longfile.length
    Write-Host "$filelength - $longfile"}