In my earlier weblog article, I used the PowerShell Format-Broad
cmdlet to format the output of a
string in a number of columns. Whereas Format-Broad
isn’t a command that I’ve used extensively, the
habits wasn’t what I anticipated.
If you pipe object-based output aside from a string from any PowerShell command to
Format-Broad
, it produces the specified outcomes.
Get-PSDrive | Format-Broad -Column 2
I’ll pipe the next to Get-Member
to substantiate that it’s a string.
'one', 'two', 'three', '4' | Get-Member
If you use Format-Broad
with a string, it doesn’t break up the outcomes into a number of columns.
'one', 'two', 'three', '4' | Format-Broad -Column 2
Extra testing and nonetheless not the outcomes I anticipated.
'one', 'two', 'three', '4' | Format-Broad -Column 2 -Pressure
'one', 'two', 'three', '4' | Format-Broad -Property $_ -Column 2
'one', 'two', 'three', '4' | Format-Broad -Property $_ -Column 2 -Pressure
'one', 'two', 'three', '4' | Format-Broad -Property {$_} -Column 2
To provide output with a number of columns from a string utilizing Format-Broad
, you must specify the
present object variable inside curly braces as the worth for the Property
parameter together with the
Pressure
parameter.
'one', 'two', 'three', '4' | Format-Broad -Property {$_} -Column 2 -Pressure
The next video demonstrates the instructions used on this weblog
article.
Jeff Hicks printed a follow-up
weblog article that includes a perform
to format the output of strings in a number of columns with PowerShell.
µ