PowerShell by Patrik

Write-Output PowerShell Cmdlet

Writes the specified objects to the pipeline. If Write-Output is the last command in the pipeline, the objects are displayed in the console.

Write-Output
     [-InputObject] <PSObject[]>
     [-NoEnumerate]
     [<CommonParameters>]

Write-Output sends objects to the primary pipeline, also known as the "output stream" or the "success pipeline." To send error objects to the error pipeline, use Write-Error.

This cmdlet is typically used in scripts to display strings and other objects on the console. One of the built-in aliases for Write-Output is echo and similar to other shells that use echo. The default behavior is to display the output at the end of a pipeline.

Examples

Write-Output "Warning: setting not available"
Write-Output "Error message" >> $logfile
Write-Output "$Message" | Tee-Object $logFile -Append

Additional Resources

Snippset

Comments