I put a button in my form that starts the command line application. The application starts but it doesn't show anything. Starting it by just clicking the executable works perfectly. This happens with all command line applications.Why this happens? Here is the code:
Process cmdApp = new Process();
private void Button9_Click(object sender, EventArgs e)
{
richTextBox1.Text = cmdApp.StandardOutput.ReadToEnd();
cmdApp.WaitForExit();
}
private void Button13_Click(object sender, EventArgs e)
{
cmdApp.StartInfo.FileName = @"C:\Users\Stelios L LAPTOP\Desktop\steamCMD\steamcmd.exe";
cmdApp.StartInfo.WorkingDirectory = @"C:\Users\Stelios L LAPTOP\Desktop\steamCMD";
cmdApp.StartInfo.UseShellExecute = false;
cmdApp.StartInfo.RedirectStandardOutput = true;
cmdApp.Start();
}
Also, when i try reading the output of the command line application, my app just freezes. The most strange thing is that when i close the command line application and try reading its output, i get some lines that all the time they say almost the same thing.
I see someone marked my question as duplicate. NOT IT ISN'T DUPLICATE. The answered question didn't help! Still Nothing. I checked the code million times. I tried everything.Nothing worked!