How to decode cmd output correctly?
ProcessStartInfo startInfo = new ProcessStartInfo("CMD.exe");
startInfo.Arguments = "/c " + URL;
Process p = new Process();
startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow = true;
p = Process.Start(startInfo);
string xxx = p.StandardOutput.ReadToEnd();
获得标准输出的正确结果,需要增加以下代码
startInfo.StandardOutputEncoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage)
- 上一篇: 在苹果OSX系统下,使用jenkins shell时判断Unity是否在运行的方法
- 下一篇: 没有了