I have a console application which I'm trying to automate by redirecting Standard input stream of the process. In manual mode after opening the application, it waits for user input like below,
I created the process with redirected Standard input stream.The code snippet is as follows,
Process newProcess = new Process();
newProcess.StartInfo.FileName = exeName;
newProcess.StartInfo.Arguments = argsLine;
newProcess.StartInfo.UseShellExecute = false;
newProcess.StartInfo.RedirectStandardOutput = false ;
newProcess.StartInfo.CreateNoWindow = false;
newProcess.StartInfo.RedirectStandardInput = true;
newProcess.Start();
But creating process like this gives an infinite loop shown below,
It's like I'm sending Enter
key command continuously to the process input stream. Can anyone point me to what I'm doing wrong here?
Similarly, standard output stream redirection is also not working after making
newProcess.StartInfo.RedirectStandardOutput = true
But I can manage with that.
Does redirection of standard streams work with all console applications or is there any exception?