What is the long form of FT
Format-Table, Format-List, Out-GridView: Format output in PowerShell
The output of PowerShell often contains many attributes, so that the representation becomes confusing. Therefore, special cmdlets can filter and rearrange the output of commands. Even a GUI option is available for this.
If you call cmdlets like Get-Process, Get-Eventlog or Get-ChildItem, they spit out a relatively large number of attributes of the displayed objects by default. In most cases, the output is in a tabular format, with longer values truncated. Pagers like more do not help here because they only prevent multipage results from being scrolled through.
Sometimes it is sufficient to filter out properties that are not required using Select-Object, so that more space remains for the remaining columns. The better choice are mostly format tables (alias ft) and Format-List (Alias fl). You can use the parameter Property also filter the displayed properties and also offer additional options for the display:
This example shows all PowerShell scripts in the current directory and outputs their name, creation date, file attributes and file size in a table.
If you stick to the tabular display, which is the default setting for most cmdlets, you can use ft with the parameter Wrap and Autosize fix the problem of truncated attribute values:
In this example, the display of the locally installed programs breaks the name and original URL, which would otherwise not fit in the column. The option Autosize on the other hand, the column width adapts, so that horizontal scrolling may be necessary for long values.
In the output of Format table however, there are differences between PowerShell 5 and earlier versions. The new variant automatically limits the number of attributes in such a way that the output fits into the window, even if you are using
has selected all properties.
Display output in list form
Despite these options for ft to display long values in full, it is often advisable to switch to output in list form. Some cmdlets that return a lot of data use this format by default, such as Get-ADUser.
In the list display, each value appears on its own line. In the example above, the call would change as follows (the optional parameter name for Property):
Multiple switches from Format table how HideTableHeaders (to omit the column headings), Wrap and Autosize have no meaning with Format-List and are accordingly not supported.
What both cmdlets have in common, however, is the ability to not only filter data, but how Group object can also be grouped based on certain attributes. An application for this would be, for example, to summarize the users of the AD in the output if they have a common manager:
This example could also be applied to other attributes such as City, Office or StreetAddress.
Graphic display with Out-GridView
Treads a different path than the two text-oriented cmdlets Out-GridView. It shows the output of PowerShell objects in tabular form on the graphical user interface Format table or Format list If you expect information in advance on how the output is to be filtered or sorted, this can be done later on the GUI using the corresponding controls.
After loading the data, you can use the button Add criteria select the fields that you want to use for a filter. Sorting is carried out, as is usual with such GUI elements, by clicking on the column headings. Attributes can be rearranged, removed or added again by opening the context menu of a column heading.
Due to this concept, Out-GridView hardly supports any parameters. With title you can change the window title, which by default contains the command in which the cmdlet was called. The switch opens up additional options Passthrubecause it forwards the selected items in the pipeline after the table is closed. This enables a simple selection menu to be implemented, for example, or certain data can be exported by clicking on it.
- Are Juggalos a misogynist subculture
- Do you speak Tulu language
- Why is gold not reactive
- What are the requirements for law school
- Which is best McLaren or Ferrari
- What is a V club
- What is your opinion on literary agents
- What is BookMyForex
- Who is the most widely read living author
- What's your favorite war song?
- America is too arrogant
- Are aspies more in principle
- Do you know a migraine cure
- Taxes India Worldwide Income
- Do hospitals block cell phone reception?
- What do you enjoy about your work?
- How much does a fly weigh
- What are the political issues of Kerala
- How big are the biggest breasts in the world
- Swedish girls meet Pakistani men
- Is rhyolite Felsic mafic or intermediaer
- Will Karl Deisseroth win a Nobel Prize
- What does a military general do