PowerShell by Patrik

Tee-Object PowerShell Cmdlet

Saves command output in a file or variable and also sends it down the pipeline.

Tee-Object
   [-InputObject <PSObject>]
   [-FilePath] <String>
   [-Append]
   [[-Encoding] <Encoding>]
   [<CommonParameters>]

The Tee-Object cmdlet redirects output, that is, it sends the output of a command in two directions (like the letter T). It stores the output in a file or variable and also sends it down the pipeline. If Tee-Object is the last command in the pipeline, the command output is displayed at the prompt.

Example

Write-Output "$Message" | Tee-Object $logFile -Append
PowerShell

Comments

Leave a Comment

All fields are required. Your email address will not be published.