このコードが cmd ウィンドウのみを表示し、最後に到達しないのはなぜですか? PsList からの出力を C# アプリに取得したいと考えています。実行は次の行で停止します: "int exitCode = proc.ExitCode;"
private static void PsList()
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\PsList.exe";
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
using (Process proc = Process.Start(start))
{
proc.WaitForExit(4000);
int exitCode = proc.ExitCode;
string exitMsg = proc.StandardOutput.ReadToEnd();
}
}