Format-Wide

Format objects as a wide table that displays only one property of each object.

Syntax
      Format-Wide [[-property] Object] [-autosize] [-column int]
          [-groupBy Object] [-view string] [-force]
             [-inputObject psobject] [-expand string]
                [-displayError] [-showError] [CommonParameters]

Key:
   -property Object[]
       The object properties to display (in order)
       Wildcards are permitted.
       You cannot use -Property and -View in the same command.

   -autosize
       Adjust the column sizes based on the width of the data.
       By default, the column size and number are determined by the view.
       You cannot use the AutoSize and Column parameters in the same command.

    -column int
       The number of columns in the display.
       Cannot be combined with the -Autosize parameter

   -hideTableHeaders
       Omit column headings from the table.

   -view string
       The name of an alternate format or "view." 
       The DotNetTypes.format.ps1xml formatting file defines these views.

   -groupBy Object
       Format the output in groups based on a shared property or value.
 
   -force 
       Override restrictions that prevent the command from succeeding, 
       without compromising security. Force will override read-only
       attributes but will not change file permissions.

   -inputObject psobject
       The objects to format. A variable, command or expression that gets the objects.
       Use for flat collections, nested collections may need to be unwrapped and passed through the pipe.

   -expand string
       Where string is either "EnumOnly" (the default), "CoreOnly" or "Both"
       "CoreOnly" will format and display properties of the collection object itself, 
       while 'emumOnly' will enumerate and display the object properties. 
       (designed around the ICollection (System.Collections) interface.)

   -displayError 
       Display errors at the command line.

   -showError 
       Send errors through the pipeline.

Standard Aliases for Format-Wide: fw

The format- cmdlets emit specialized formatting directives, so they do not ouptut a standard PowerShell object, for this reason they should in the pipeline after (to the right) of any WHERE filter.

The value of -GroupBy or -Property can be a new calculated property. To create a calculated property, use a hash table. Valid keys are:

Name (or Label) string    (-GroupBy only)
Expression string or script block
FormatString string

Examples

Display filenames in the current directory in 3 columns:

PS C:\> get-childitem | format-wide -column 3

Display registry key names, the default property "Name" is the full registry pathname:

PS C:\> get-childitem HKCU:\software\microsoft | format-wide -autosize

Display registry key names:

PS C:\> get-childitem HKCU:\software\microsoft | format-wide -property pschildname -autosize

"We judge ourselves by what we feel capable of doing, while others judge us by what we have already done" ~ Henry Wadsworth Longfellow

Related PowerShell Cmdlets

format-custom - Format output using a customized view.
format-list - Format output as a list of properties, each on a new line.
format-table - Format output as a table.
out-file - Send command output to a file.
out-host - Send the pipelined output to the host.


 
Copyright © 1999-2024 SS64.com
Some rights reserved