プロセスを使用して、process.StartInfo.RedirectStandardOutput = true; の使用中に例外が発生しています。例外は、「StandardOut がリダイレクトされていないか、プロセスがまだ開始されていない」の下にあります。
アプリケーションGUIをハングさせるprocess.WaitForExitを使用しているので、process.StandardOutput.ReadToEnd();を使用しました。MSDN による WaitForExit の前ですが、プロセスが無限に実行され、ログ ファイルで上記の例外が発生し、GUI もハングします。
Process process = new Process();
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
string strArguments = "";
process.StartInfo.FileName = @"appname.bat";
process.StartInfo.Arguments = strArguments;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
process.Close();
どこに欠けているのか、コードのどこにエラーがあるのか わかりません... waitforexitでもタイムアウトを試みましたが、成功しませんでした。