c#关于执行cmd命令,待机问题

using System.Diagnostics;


Process por = new Process();
            por.StartInfo.FileName = "cmd.exe";
            por.StartInfo.UseShellExecute = false;
            por.StartInfo.RedirectStandardInput = true;
            por.StartInfo.RedirectStandardOutput = true;
            por.StartInfo.RedirectStandardError = true;
            por.StartInfo.CreateNoWindow = true;        
            por.Start();
            por.StandardInput.WriteLine("shutdown /h");
            por.StandardInput.WriteLine("Exit");
            por.StandardOutput.ReadToEnd();

你可能感兴趣的:(cmd)