I have a test.exe written by c#, the code is simply call Console.ReadLine(); and I want to run:
$p = Start-Process test.exe -RedirectStandardOutput .\out.txt -PassThru
when run without -RedirectStandardOutput:
$p = Start-Process test.exe -PassThru
everything looks good.
but if:
$p = Start-Process test.exe -RedirectStandardOutput .\out.txt -PassThru
the powershell console hang, you cannot input anything, until you close the test.exe command prompt.
why this happen, anyway can keep test.exe running and I still can use the powershell console?