C# を使用して .exe プログラムを起動し、.exe から生成された cmd から値を読み取りたい
.exe は正常に起動しますが、値を読み取ることができません。
これは私のコードです:
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = (@"D:\BSC\Thesis\Raphael_Thesis\smiledetector\bin\smiledetector.exe");
start.WorkingDirectory = @"D:\BSC\Thesis\Raphael_Thesis\smiledetector\bin\";
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
//Start the process
using (Process process = Process.Start(start))
{
// Read in all the text from the process with the StreamReader.
using (StreamReader reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
textBox1.Text = result;
}
}