fahadash
fahadash

Reputation: 3281

How to have powershell command output not suppressed from console when the output is piped?

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?

Upvotes: 0

Views: 63

Answers (1)

Where-Object {write-host $_; $_ -match 'pattern' }

Upvotes: 1

Related Questions