私は方法があります:この方法はなぜ私の出力を.exe [ffmpeg]からリダイレクトしないのですか?
public static string StartProcess(string exePathArg, string argumentsArg, int timeToWaitForProcessToExit)
{
string retMessage = "";
using (Process p = new Process())
{
p.StartInfo.FileName = exePathArg;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.Arguments = argumentsArg;
p.StartInfo.UseShellExecute = false;
try
{
p.Start();
StreamReader myOutput = p.StandardOutput;
retMessage = "STANDARD OUTPUT: " + myOutput.ReadToEnd();
p.WaitForExit(timeToWaitForProcessToExit);
}
catch (Exception ex)
{
retMessage = "EXCEPTION THROWN: " + ex.ToString();
}
finally
{
try
{
p.Kill();
}
catch { }
}
}
return retMessage;
}
をしかし、それはretMessageに私の出力をリダイレクトdoes notの。誰にでもアイデアはありますか?私はバットファイルの引数をテストし、出力は間違いなく出力されます。
乾杯、 ピート
おそらく、プロセスはStandardOutputに書き込むのではなく、StandardErrorだけに書き込みますか? – dtb