7.5. Using the format-list Cmdlet

The format-table cmdlet is useful when the values to be displayed are short or values to be displayed are few. But when there are many values to be displayed or if individual values are long then using the format-table cmdlet can produce unsatisfactory output. For example, if you wanted to see all the properties returned by the get-childitem cmdlet in a table you would use a command like this:

get-childitem |
format-table *

Figure 7-28 show the type of results you will see. As you can see, the values in many columns are truncated to the point of being useless as a source of information to the user.

Figure 7.28. Figure 7-28

In this situation, Windows PowerShell, by default, displays too many columns onscreen. The format-list cmdlet allows you to better display all the information onscreen.

This example uses the format-list cmdlet to ensure that the complete value of each property is displayed for each process.

Type this command:

get-childitem |
format-list *

The first part of the output is shown in Figure 7-29. You can now see the value for each property without any truncation. The downside is that the information is spread across many screens of information — but at least you can view the information you want.

Figure 7.29. Figure 7-29

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.