这主要是双击应用程序重启电脑。
private void Form1_Load(object sender, System.EventArgs e) { System.Diagnostics.Process.Start("shutdown.exe","-r -t 0"); }
System.Diagnostics.Process.Start的用法
System.Diagnostics.Process.Start(@ "D:/freeware/Maxthon/Maxthon.exe ", "http://www.csdn.net "); 或者 Process p = new Process(); p.StartInfo.FileName = @ "D:/freeware/Maxthon/Maxthon.exe "; p.StartInfo.Arguments = @ "http://www.csdn.net "; p.Start();
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- System.Diagnostics.Process.Start("Iexplore.exe", "http://www.yongfa365.com");
- //在当前窗口打开
- //System.Diagnostics.Process.Start("http://www.yongfa365.com");
- //如果在新窗口中打开可以加上要执行的文件及参数的形式
- //System.Diagnostics.Process.Start("Iexplore.exe", "http://www.csdn.net");
- //System.Diagnostics.Process.Start("cmd", "/k echo 'ok'");
- //System.Diagnostics.Process.Start("explorer", "C://windows//system32");
- //System.Diagnostics.Process.Start("shutdown","/l");//------------注销计算机
- //System.Diagnostics.Process.Start("shutdown","/r");//------------重起计算机
- }