【发布时间】:2020-05-13 17:30:58
【问题描述】:
Process p = new Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "sfc.exe";
p.StartInfo.Arguments = " /VERIFYONLY";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
string error = p.StandardError.ReadToEnd();
string output = p.StandardOutput.ReadToEnd();
/processOutput 得到的输出类似于 "\n\0\n\0\n\0M\0i\0c\0r\0o\0s\0o\0f\0t\0 \0(\0R\ 0)\0 \0W\"/ 字符串过程输出=输出+错误; p.WaitForExit();
【问题讨论】:
标签: c# .net windows command-line process