Out-Default

Send output to default

Syntax
      Out-Default [-inputObject psobject] [CommonParameters]

Key
   -inputObject     The input item {may be piped}

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

This cmdlet has no effect on the formatting or output. It is a placeholder that lets you write your own Out-Default function or cmdlet.

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

PS C:\> get-date
Friday, December 17, 2010 18:23:43

PS C:\> function out-default { "hello" }
PS C:\> get-date

PS C:\> function out-default { "hello" | out-host }
PS C:\> get-date
hello
PS C:\> del function:out-default
PS C:\> get-date
Friday, December 17, 2010 18:24:52

"Talk is cheap. Show me the code" ~ Linus Torvalds, 2006

Related PowerShell Cmdlets:

Out-File - Send command output to a file.
Out-Host - Send the pipelined output to the host.
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.


 
Copyright © SS64.com 1999-2019
Some rights reserved