PowerShell Logo Small

Write-Output



This is the built-in help made by Microsoft for the command 'Write-Output', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Sends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline, the objects are displayed in the console.

SYNTAX


Write-Output [-InputObject] <PSObject[]> [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String[]>]]
[-NoEnumerate] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Write-Output cmdlet sends the specified object down the pipeline to the next command. If the command is the last command in the pipeline, the object is displayed in the
console.


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


This cmdlet is typically used in scripts 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 the cmdlet. For example, "get-process | write-output" is equivalent to "get-process".



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=294030
Tee-Object
Write-Debug
Write-Error
Write-Host
Write-Progress
Write-Verbose
Write-Warning

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>$p = get-process
PS C:\>write-output $p
PS C:\>$p



These commands get objects representing the processes running on the computer and display the objects on the console.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>write-output "test output" | get-member



This command pipes the "test output" string to the Get-Member cmdlet, which displays the members of the String class, demonstrating that the string was passed along the
pipeline.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>write-output @(1,2,3) | measure

Count    : 3
...

PS C:\>write-output @(1,2,3) -NoEnumerate | measure

Count    : 1



This command adds the NoEnumerate parameter to treat a collection or array as a single object through the pipeline.