I have a PS command:
PowerShell.exe "dir -Verbose -Recurse | Select-Object Mode, Length, Name, Directory | Export-Csv "listing.csv""
I've dealt with this a bunch, 8.3 notation unfortunately still doesn't work in a lot of cases as the filenames could still be over 260 characters. It's possible to use drive mounting to shorten the filenames but that can be a bit of a pain. Best way I've found is to circumvent the problem using a .NET library called AlphaFS that does not have the 260 character limitation, you can read more or download it here. Will take a bit of getting used to if you haven't worked directly with .NET classes before but it's much better than trying weird hacks or dealing with 8.3 notation. Once you have the assembly loaded you would replace
dir -verbose -recurse with
([Alphaleonis.Win32.Filesystem.Directory]::GetFiles((pwd).path,"*","AllDirectories")). Note that that will only get files, for directories you use the same code except replacing