Out-Host
Additional Resources for Out-Host |
Viewing Data One Screen at a Time http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/out-host.mspx
|
SYNOPSIS
Sends output to the command line.
SYNTAX
Out-Host [-paging] [-inputObject <psobject>] [<CommonParameters>]
DETAILED DESCRIPTION
The Out-Host cmdlet sends output to the Windows PowerShell host for display. The host displays the output at the command line. Because Out-Host is the default, you do not need to specify it, unless you want to use its parameters to change the display.
PARAMETERS
-paging <SwitchParameter>
Displays one page of output at a time, and waits for user input before displaying the remaining pages, much like the traditional "more" command. By default, all of the output is displayed on a single page. The page size is determined by the characteristics of the host.
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-inputObject <psobject>
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.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByValue) |
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
Any
RETURN TYPE
None
NOTES
For more information, type "Get-Help Out-Host -detailed". For technical information, type "Get-Help Out-Host -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 Out-Host by its built-in alias, "oh". For more information, see About_Alias.
The Out cmdlets do not format objects; they just render them 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 do not have parameters for names or file paths. To send data to an Out cmdlets, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a variable and use the -InputObject parameter to pass the data to the cmdlet. For help, see the examples.
Out-Host sends data, but it does not emit any output objects. If you pipe the output of Out-Host to Get-Member, Get-Member reports that no objects have been specified.
EXAMPLE 1
get-process | out-host -paging
This command displays the processes on the system one page at a time. It uses the Get-Processcommand to get the processes on the system. The pipeline operator (|) sends the results to Out-Host which displays them at the console. The Paging parameter displays one page of data at a time.
The same command format is used for the Help function that is built into Windows Powershell. That function gets data from Get-Help and then uses the Paging parameter of Out-Host to display the data one page at a time: get-help $args[0] | out-host -paging).
EXAMPLE 2
$a = get-history
out-host -InputObject $a
These commands display the session history at the command line. The first command uses the Get-Historycmdlet to get the session history, and then it stores the history in the $a variable. The second command uses Out-Host to display content of the $a variable and uses the InputObject parameter to specify the variable to Out-Host.
RELATED LINKS