34,333
edits
Changes
no edit summary
== Formatting PowerShell Output ==
So far in this chapter we have explored techniques to direct output generated from Windows PowerShell scripts but have left PowerShell to decide how to format the output based on its the data's type. In practice, however, it is unlikely that the default format will always be the desired format. Consequently, PowerShell provides a number of formatting cmdlets through which output may be piped using the '|' character to change the way the information is presented to the user.
The first of these format cmdlets is the ''format-table'' command (also available via the ''ft'' alias). This cmdlet displays the output data as a series of columns. This is actually the default format option for output from the ''get-childitem'' command which displays the contents of a directory. For example:
<pre>
</pre>
The ''format-wide'' (fl) cmdlet allows a specific data field from the output to be displayed in a tabular form comprising a specific number of columns. For example, to display just the ''Name'' field of the ''get-childitems'' output is as a table 4 four columns is in width, the folling following command would be executed:
<pre>