0

I have the following powershell command

c:\path\to\exectuable.exe -param1 -param2 | Where-Object { $_ -match 'pattern' } | ForEach-Object { $output = $output + $_ }

The problem with the above is that, it is suppressing the console output of the executable. I understand the output is piped, I additionally want it to be written to the console like it would if it wasn't piped. How do I do that?

2
  • 3
    If you want to save and keep the output, use tee-object. Commented Dec 1, 2020 at 17:12
  • 2
    Or you can use -OutVariable to see and store it Commented Dec 1, 2020 at 17:19

1 Answer 1

1
Where-Object {write-host $_; $_ -match 'pattern' }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.