How to fix truncated PowerShell output, even when I've specified -width 300
Pipe output to Format-Table commandlet, e.g. as follows:
Get-ChildItem 'E:\' -Force -Recurse | Select-Object FullName | Format-Table -AutoSize
or
(Get-ChildItem 'E:\' -Force -Recurse).FullName | Format-Table -AutoSize
Note that -Width
parameter of Out-File
cmdlet specifies the number of characters in each line of output. Any additional characters are truncated, not wrapped. However, -Width 300
should suffice in this case.
for me it works best with piping to export-csv
https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Export-Csv?view=powershell-3.0
simply:
GCI 'E:\' -Recurse | Select FullName | Export-CSV Files.csv
without double quotes:
Add-Content -Path Files.txt -Value (GCI 'E:\' -Recurse).FullName