Out-Host

Send output to the host (typically the console screen).

Syntax
      Out-Host [-inputObject psobject] [-paging] [CommonParameters]

Key
   -inputObject psobject
       The object(s) to be written to the console. 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.
       {may also be piped}

   -paging 
       Display one page of output at a time, and wait for user input before 
       displaying more. By default, all output is displayed on a single page. 
       The page size is determined by the characteristics of the host.

Standard Aliases for Out-Host: oh

Out-Host sends output to the PowerShell host for display.

The final part of displaying PowerShell output is a hidden background call to an Output cmdlet, by default as the last part of the execution process PowerShell calls the default output cmdlet which is typically Out-Host.

Examples

Display system processes one page at a time:

PS C:\> get-process | out-host -paging

Display a snapshot of the session history at the command line:

PS C:\> $a = get-history
PS C:\> out-host -InputObject $a

“less is more” ~ Ludwig Mies van der Rohe

Related PowerShell Cmdlets

Out-Default - Send output to default.
Out-File - Send command output to a file.
Out-GridView - Send output to an interactive table.
Out-Null - Send output to null.
Out-Printer - Send the output to a printer.
Out-String - Send output to the pipleline as strings.
Tee-Object - Send input objects to two places.
Clear-Host - Clear the screen.
Write-Host - Display objects through the host user interface.
Equivalent bash command: less - Display output one screen at a time.


 
Copyright © 1999-2024 SS64.com
Some rights reserved