ウィンドウを使用しないか、最小化するようにプロセスに指示できます。
// don't execute on shell
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
// don't show window
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
出力をUseShellExecute = false
リダイレクトできます:
// redirect standard output as well as errors
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
これを行うときは、出力バッファーの非同期読み取りを使用して、バッファーのオーバーフィルによるデッドロックを回避する必要があります。
StringBuilder outputString = new StringBuilder();
StringBuilder errorString = new StringBuilder();
p.OutputDataReceived += (sender, e) =>
{
if (e.Data != null)
{
outputString.AppendLine("Info " + e.Data);
}
};
p.ErrorDataReceived += (sender, e) =>
{
if (e.Data != null)
{
errorString.AppendLine("EEEE " + e.Data);
}
};