//关闭计算机.
private void button3_Click(object sender, EventArgs e)
{
System.Diagnostics.Process mp = new System.Diagnostics.Process();
mp.StartInfo.FileName = "cmd.exe";
mp.StartInfo.RedirectStandardInput = true;
mp.StartInfo.RedirectStandardOutput = true;
mp.StartInfo.RedirectStandardError = true;
mp.StartInfo.UseShellExecute = false;
mp.StartInfo.CreateNoWindow = true;
mp.Start();//启动进程
mp.StandardInput.WriteLine("shutdown -s -t 0");//关机
}
|