How to capture binary stdout of a console exe run from Powershell?
powershell
Solution
Got some info from the PowerShell team. The short answer is that unfortunately, it is not easy. :-(
The medium length answer is: http://poshcode.org/2175.
The long answer is: Capture and Redirect Binary Process Output
Problem
Is it possible to get Powershell to read the stdout of an exe into a byte[] instead of the usual text processed array of lines? Best I've been able to do is this: ``` cmd /c foo.exe > foo.tmp $b = [io.file]::readallbytes('foo.tmp') del foo.tmp ``` Yucky, not to mention it is not streamable. Any better way to do this?