View Single Post
Old 06-26-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Validation needed: Tabular output throws OutofMemoryException errors with Out-File -Width 0x7fffffff

Could I get someone else to validate errors using the maximum
possible -width for Out-File when output is going to be tabular?

PS> Get-Command | Out-File -FilePath c:\temp\output.txt -Width 2147483647
out-lineoutput : Exception of type 'System.OutOfMemoryException' was thrown.

PS> Get-Command | Out-File -FilePath c:\temp\output.txt -Width 0x7fffffff
out-lineoutput : Exception of type 'System.OutOfMemoryException' was thrown.

PS> Get-Command | Format-Table -Property * | Out-File -FilePath
c:\temp\output.txt -Width 0x7fffffff
out-lineoutput : Exception of type 'System.OutOfMemoryException' was thrown.

Note that if I either explicitly use Format-List or use Select-Object *
(which forces list formatting) that it works fine:

PS> Get-Command | Format-List -Property * | Out-File -FilePath
c:\temp\output.txt -Width 0x7fffffff
PS> Get-Command | Select-Object -Property * | Out-File -FilePath
c:\temp\output.txt -Width 0x7fffffff
PS>


My System SpecsSystem Spec