Tag: startprocessinfo

ProcessInfo和RedirectStandardOutput

我有一个应用程序在命令窗口中调用另一个进程,该进程已更新输出到控制台窗口的统计信息。 我认为这是一个相当简单的操作,但我似乎无法让它工作。 我错过了什么吗? string assemblyLocation = Assembly.GetExecutingAssembly().Location; Process process = new Process { ProcessStart = { RedirectStandardOutput = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden, Arguments = arg, FileName = assemblyLocation.Substring(0, assemblyLocation.LastIndexOf(“\\”)) + “\\ffmpeg.exe”, CreateNoWindow = true } }; process.Start(); Console.WriteLine(process.StandardOutput.ReadToEnd()); process.WaitForExit(); 理想情况下,我想要的是输出在我触及的过程中发生变化,或者数据进入读者,我从中得到了事件。 任何帮助都会很棒,我觉得这是一个新手问题,但似乎缺少一些东西。