I am trying to write a PowerShell script that will run a console app which is a .exe file, poll the stdout from the .exe, and depending on what get's printed to the console, will invoke a key-stroke or exit (Ctrl+C) the application. I want to be able to read the console output while the process is still running. So I don't want to wait until the process is complete.
Initially, I tried to accomplish this by creating a System.Diagnostics.Process
object and calling .Start()
on that process and then getting the .StandardOutput
from that object. But that looks like it waits until the process is complete as I have tested the ping
command.