I am trying to open the console application from my windows forms application. I have used the below code. The code is opening the Console application but not displaying anything (showing only black screen). But I am successfully able get the console output using StandardOutput.
Process proc = new Process();
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.FileName = @"C:\Program Filex86)\ConsoleTool.exe";
proc.Start();
StreamWriter sw = proc.StandardInput;
sw.WriteLine("init");
txtOutput.Text += proc.StandardOutput.ReadToEnd().Replace("\n", "\r\n");
txtOutput.Text += proc.StandardError.ReadToEnd().Replace("\n", "\r\n");
proc.WaitForExit();
How to get the display on console window that is opened using code?