Summary: Learn how to send output to both the Windows PowerShell console and to a variable.
Image may be NSFW.
Clik here to view. How can I easily send Windows PowerShell output to both the console and to a variable?
Image may be NSFW.
Clik here to view. Use the Tee-Object cmdlet and specify a variable name, as shown here.
PS C:\> gps | select name -Last 1 | Tee-Object -Variable a
Name
----
ZeroConfigService
PS C:\> $a
Name
----
ZeroConfigService
Image may be NSFW.
Clik here to view.
>
Image may be NSFW.Clik here to view.
