다음을 통해 공유


Using the Format-Wide Cmdlet

Displaying Data in Multiple Columns

The Format-Wide cmdlet allows you to retrieve single-item data (such as a process name) and display that data in multiple columns. By default, Format-Wide displays data in two columns; this command uses Get-Process to retrieve process information and then displays the process names in two-columns:

Get-Process | Format-Wide

In other words, you get back something similar to this:

alg                                     apdproxy
asghost                                 ati2evxx
ati2evxx                                atiptaxx
BTStackServer                           BTTray
btwdins                                 csrss
ctfmon                                  DLACTRLW
eabservr                                explorer
HP Wireless Assistant                   HPQTOA~1
hpqwmi                                  hpqwmiex

Alternatively, you can use the -columns parameter to specify the number of columns; this command displays process information in four columns:

Get-Process | Format-Wide -columns 4

If any process names are longer than the allotted column space those names will be truncated like so (notice that FastUserSwitching doesn’t quite fit):

FastUserSwitchin... helpsvc
hpqwmiex            HTTPFilter
InoRPC              InoRT

If you aren’t sure how many columns to use when displaying information, then why not let Windows PowerShell figure that out for you? Just use the -autosize parameter and Windows PowerShell will calculate the maximum number of columns that can be used without truncating the data:

Get-Process | Format-Wide -autosize
Format-Wide Aliases
  • fw