Formatting
Formatting in PowerShell encompasses use of the Format-
and Out-
commands from the built-in Microsoft.PowerShell.Utility
module.PowerShell includes a complex formatting system which allows command authors to dictate the default appearance of objects in the console. Objects shown in the console almost always have more properties available than are displayed by default.
Formatting and exporting
It is important to note that format commands shown in this section should not be used alongside commands like Export-Csv
. Formatting commands completely change the objects they receive into a set of formatting instructions.This can be seen by combining Format-Table
and ConvertTo-Csv
in the example pipeline below:
Get-Process |
Select-Object Name, ID, WorkingSet -First 2 |
Format-Table |
ConvertTo-Csv
This example will generate output like that shown below:
"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo...