snippetbashTip
Tee-Object — Saves command output in a file or variable and also sends it down the pipeline. Note: This command c
Viewed 0 times
commandsavesclifilevariabletee-objectoutput
windows
Problem
How to use the
Tee-Object command: Saves command output in a file or variable and also sends it down the pipeline. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/tee-object>.Solution
Tee-Object — Saves command output in a file or variable and also sends it down the pipeline. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/tee-object>.Output processes to a file and to the console:
Get-Process | Tee-Object -FilePath {{path\to\file}}Output processes to a variable and
Select-Object:Get-Process notepad | Tee-Object -Variable {{proc}} | Select-Object processname,handlesCode Snippets
Output processes to a file and to the console
Get-Process | Tee-Object -FilePath {{path\to\file}}Output processes to a variable and `Select-Object`
Get-Process notepad | Tee-Object -Variable {{proc}} | Select-Object processname,handlesContext
tldr-pages: windows/Tee-Object
Revisions (0)
No revisions yet.