Processで実行したコンソールの出力を消さずに取得したい

C#でProcessを実行し、その出力を受け取るという処理をしたいのですが、RedirectStandardOutputをtrueにすると実行したコンソールに何も表示されなくなってしまいます。

該当コード

Process p = new Process(); p.StartInfo.WorkingDirectory = Path.GetDirectoryName(file); p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = file; p.StartInfo.Arguments = arguments; p.Start(); string output; while (!p.HasExited) { output = p.StandardOutput.ReadLine() ?? ""; if (output.Contains("Application started.")) break; }

どなたかご教授お願い致します。

コメントを投稿

0 コメント