Write an object to the pipeline. If the command is the last command in the pipeline, the objects are displayed in the console.
Syntax
Write-Output [-inputObject] Object[] [CommonParameters]
Key
-inputObject Object
The object(s) to send along the pipeline.
A variable, command or expression that gets the objects.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Write-Output writes objects to the success pipeline. To have output appear only on screen use write-host or Write-Warning instead.
Write-Output may be used to display strings and other objects on the console. However, because the default behavior is to display the objects at the end of a pipeline, it is generally not necessary to use Write-Output. For example, get-process | write-output is equivalent to get-process
Examples
Write a string to the pipeline, which by default will appear on the screen:
PS C:\> $myvar="The quick brown fox"
PS C:\> write-output $myvar
"We attract hearts by the qualities we display; we retain them by the qualities we possess" ~ Jean Baptiste Antoine Suard
Related:
Tee-Object - Send input objects to two places
Write-Debug - Write a debug message to the host display
Write-Error - Write an object to the error pipeline.
Write-Host - Display objects through the host user interface
Write-Progress - Display a progress bar
Write-Verbose - Write a string to the host’s verbose display
Write-Warning - Write a warning message
© Copyright SS64.com 1999-2013
Some rights reserved