Send output to default.
Syntax Out-Default [-inputObject psobject] [CommonParameters] Key -inputObject The input item {may be piped}
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 most common use of this is to temporarily define an empty Out-Default function which will supress all output.
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.
When running an external Windows .EXE executable from a PowerShell script, by default the script will not wait and will immediately continue to the next command. Piping the command to out-null or out-default will force PowerShell to wait for the process to exit before continuing. An alternative method of doing this is Start-Process -wait
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:\> Remove-Item function:out-default
PS C:\> get-date
Friday, December 17, 2010 18:24:52
Supressing all output:
PS C:\> function Out-Default {}
PS C:\> get-date
<no output>
PS C:\> Remove-Item function:out-default
"Talk is cheap. Show me the code" ~ Linus Torvalds, 2006
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.