Ich habe die Methode:Warum leitet diese Methode meine Ausgabe nicht von .exe [ffmpeg] um?
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;
}
Aber es funktioniert nicht meine Ausgabe zu retMessage umleiten. Irgendwelche Ideen? Ich habe die Argumente in einer Bat-Datei getestet und die Ausgabe wird definitiv ausgegeben.
Cheers, Pete
Vielleicht schreibt der Prozess nicht in StandardOutput sondern nur in StandardError? – dtb