Out-Host
Sends output to the command line.
Syntax
All
Out-Host
[-Paging]
[-InputObject <PSObject>]
[<CommonParameters>]
Description
The Out-Host cmdlet sends output to the PowerShell host for display. The host displays the output
at the command line. Because Out-Host is the default, you don't have to specify it unless you want
to use its parameters.
Out-Host is automatically appended to every command that is executed. It passes the output of the
pipeline to the host executing the command. Out-Host ignores ANSI escape sequences. The escape
sequences are handled by the host. Out-Host passes ANSI escape sequences to the host without
trying to interpret or change them.
Examples
Example 1: Display output one page at a time
This example displays the system processes one page at a time.
Get-Process | Out-Host -Paging
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
30 24.12 36.95 15.86 21004 14 ApplicationFrameHost
55 24.33 60.48 10.80 12904 14 BCompare
<SPACE> next page; <CR> next line; Q quit
9 4.71 8.94 0.00 16864 14 explorer
<SPACE> next page; <CR> next line; Q quit
Get-Process gets the system processes and sends the objects down the pipeline. Out-Host uses the
Paging parameter to display one page of data at a time.
Example 2: Use a variable as input
This example uses objects stored in a variable as the input for Out-Host.
$io = Get-History
Out-Host -InputObject $io
Get-History gets the PowerShell session's history, and stores the objects in the $io variable.
Out-Host uses the InputObject parameter to specify the $io variable and displays the
history.
Parameters
-InputObject
Specifies the objects that are written to the console. Enter a variable that contains the objects, or type a command or expression that gets the objects.
Parameter properties
| Type: | PSObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Paging
Indicates that Out-Host displays one page of output at a time, and waits for user input before the
remaining pages are displayed. By default, all the output is displayed on a single page. The page
size is determined by the characteristics of the host.
Press the Space bar to display the next page of output or the Enter key to view the next line of output. Press Q to quit.
Paging is similar to the more command.
Note
The Paging parameter isn't supported by the PowerShell ISE host.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
PSObject
You can send objects down the pipeline to Out-Host.
Outputs
None
Out-Host doesn't generate any output. It sends objects to the host for display.
Notes
The Paging parameter isn't supported by all PowerShell hosts. For example, if you use the
Paging parameter in the PowerShell ISE, the following error is displayed:
out-lineoutput : The method or operation is not implemented.
The cmdlets that contain the Out verb, Out-, don't format objects. They render objects and
send them to the specified display destination. If you send an unformatted object to an Out-
cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.
The Out- cmdlets don't have parameters for names or file paths. To send data to an Out- cmdlet,
use the pipeline to send a PowerShell command's output to the cmdlet. Or, you can store data in a
variable and use the InputObject parameter to pass the data to the cmdlet.
Out-Host sends data, but it doesn't produce any output objects. If you pipeline the output of
Out-Host to the Get-Member cmdlet, Get-Member reports that no objects have been specified.