'Powershell output column width
If I have an executable out.exe and it's stdout is redirected to a file,
i.e.:
out.exe > $file
Right now if I do this it only outputs:
<----------------------------->
80 columns per line to the file
Is there a way to make the standard output to be wider in console column count?
Is it the out.exe that's somehow messing with the columns?
In my case I'm using fxcopcmd.exe.
Solution 1:[1]
Both the out-file and out-string cmdlets have a width parameter:
out.exe | out-file -width 132 -filePath $file
Solution 2:[2]
If you're talking about Windows PowerShell - just open "properties > Layout" increase buffer size + window size

Solution 3:[3]
I know this is a pretty old post at this point, but figured I'd throw my 2 cents in for people that stumble upon this for future use. From the sounds of it, OP is trying to increase the console window size so that lines do not wrap. My typical resolution I use to solve this:
$Width = $host.UI.RawUI.MaxPhysicalWindowSize.Width
$host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.size($Width,2000)
This should open up your output file so that wrapping is avoided and no conflict with -Stream (if being used) is created.
EDIT: This command is really only needed for older versions of PS (Below 7.1). Newest version should be able to get by with just -Width 500 after Out-String/File.
Solution 4:[4]
In my powershell script I set the first line to not do carriage returns the second line I manually did a return.
(within a loop)
Write-Host -nonewline "$var1;$var2"
Write-Host "`r"
That overrode the issue with having my line wrapped but still doing a return after each individual record.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lee |
| Solution 2 | Edmund Sulzanok |
| Solution 3 | |
| Solution 4 | bgmCoder |
