ProcessStartInfo.UseShellExecute 属性需要设置为true
Process proc = new Process(); proc.StartInfo.UseShellExecute = true; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo.FileName = "cmd.exe"; proc.StartInfo.RedirectStandardError = false; proc.StartInfo.RedirectStandardOutput = false; proc.Start(); proc.WaitForExit();
[参考]
ProcessStartInfo.UseShellExecute 属性