来个最有效的
using System.Dinogistics;//引用该空间
按钮click事件
System.Dinogistics.Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow =true;
p.Start();
p.StandardInput.WriteLine("shutdown -s -t 0");
p.StandardInput.WriteLine("exit");
p.close();