Format-Wide

 

Additional Resources for Format-Wide

 

Displaying Data in Multiple Columns

http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/format-wide.mspx

 

 

SYNOPSIS

Formats 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>]

 

DETAILED DESCRIPTION

The Format-Wide cmdlet formats objects as a wide table that displays only one property of each object. You can use the Property parameter to determine which property is displayed.

 

PARAMETERS

 

-property <Object>

Specifies the object properties that appear in the display and the order in which they appear. Wildcards are permitted. 

 

If you omit this parameter, the properties that appear in the display depend on the object being displayed. The parameter name ("-Property") is optional. You cannot use the Property and View parameters in the same command.

 

Required?

false

Position?

1

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-autosize <SwitchParameter>

Adjusts the column size and number of columns 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.

 

Required?

false

Position?

named

Default value

False

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-column <int>

Specifies the number of columns in the display. You cannot use the Autosize and Column parameters in the same command.

 

Required?

false

Position?

named

Default value

2

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-groupBy <Object>

Formats the output in groups based on a shared property or value. Enter an expression or a property of the output.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-view <string>

Specifies the name of an alternate table format or "view." You cannot use the Property and View parameters in the same command.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-force <SwitchParameter>

Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security. For example, Force will override the read-only attribute or create directories to complete a file path, but it will not attempt to change file permissions.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-inputObject <psobject>

Specifies the objects to be formatted. Enter a variable that contains the objects or type a command or expression that gets the objects.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

true (ByValue)

Accept wildcard characters? 

false

 

-expand <string>

Formats the collection object, as well as the objects in the collection. This parameter is designed to format objects that support the ICollection (System.Collections) interface.

 

Valid values are:

 

·          Enum (default): Displays the properties of the objects in the collection.

·          Core: Displays the properties of the collection object.

·          Both: Displays the properties of the collection object and the properties of objects in the collection.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-displayError <SwitchParameter>

Displays errors at the command line.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-showError <SwitchParameter>

Sends errors through the pipeline.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".

 

INPUT TYPE

Object

 

RETURN TYPE

Formatted objects

 

NOTES

 

For more information, type "Get-Help Format-Wide -detailed". For technical information, type "Get-Help Format-Wide -full".

 

 When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

 

You can also refer to Format-Wide by its built-in alias, "fw". For more information, see About_Alias.

 

The -Groupby parameter assumes that the objects are sorted. Before using Format-Customto group the objects, use Sort-Objectto sort them.

 

The -View parameter lets you specify an alternate format for the table. You can use the views defined in the *.format.PS1XML files in the Windows PowerShell directory or you can create your own views in new PS1XML files and use the Update-FormatDatacmdlet to include them in Windows PowerShell.

 

The alternate view for the View parameter must use table format; if not, the command fails. If the alternate view is a list, use Format-List. If the alternate view is neither list nor table, use Format-Custom.

 

EXAMPLE 1

 

get-childitem | format-wide -column 3

 

This command displays the names of files in the current directory in three columns across the screen. The Get-Childitemcmdlet gets objects representing each file in the directory. The pipeline operator (|) passes the file objects through the pipeline to Format-Wide, which formats them for output. The Column parameter specifies the number of columns.

 

EXAMPLE 2

 

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

 

This command displays the names of registry keys in the HKEY_CURRENT_USER\Software\Microsoft key. The Get-Childitemcmdlet gets objects representing the keys. The path is specified as "HKCU:", one of the drives exposed by the Windows PowerShell registry provider, followed by the key path. The pipeline operator (|) passes the registry key objects through the pipeline to Format-Wide, which formats them for output. The Property parameter specifies the name property and the Autosize parameter adjusts the columns for readability.

 

RELATED LINKS

Format-Custom

Format-Table

Format-List

Out-Host

Out-File