Out-Default
Sends the output to the default formatter and to the default output cmdlet.
Syntax
Out-Default
[-Transcript]
[-InputObject <PSObject>]
[<CommonParameters>]
Description
PowerShell automatically adds Out-Default
to the end of every pipeline. Out-Default
decides how
to format and output the object stream. If the object stream is a stream of strings, Out-Default
pipes these directly to Out-Host
which calls the appropriate APIs provided by the host. If the
object stream does not contain strings, Out-Default
inspects the object to determine what to do.
First it looks at the object type and determines whether there is a registered view for this
object type.
PowerShell defines XML schema and a mechanism (the Update-FormatData
cmdlet) where anyone can
register views for an object type. You can specify wide, list, table, or custom
views for any object type. The views specify which properties to display and how they should be
displayed. If a view is registered, it defines which formatter to use. So if the registered view is
a table view, Out-Default
streams the objects to Format-Table | Out-Host
. Format-Table
transforms the objects into a stream of Formatting records (driven by the data in the view
definition) and Out-Host
transforms the formatting records into calls on the Host interface.
Examples
Example 1
While this cmdlet is not intended to be run directly by the end user, it can be.
Get-Process | Select-Object -First 5 | Out-Default
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
12 2.56 5.20 0.00 7376 0 aesm_service
48 34.32 18.10 26.64 9320 13 AlertusDesktopAlert
24 13.97 12.74 0.77 12656 13 ApplicationFrameHost
8 1.79 4.41 0.00 8180 0 AppVShNotify
9 1.99 5.07 0.19 19320 13 AppVShNotify
Parameters
-InputObject
Accepts input to the cmdlet.
Type: | PSObject |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Transcript
Determines whether the output should be sent to PowerShell's transcription services.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |