Windows 7在GUI中关闭代码 [英] windows 7 ShutDown Code In GUI
本文介绍了Windows 7在GUI中关闭代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在写此代码...但是执行此代码时,就会出现新表格..
I m Writing Code This...But When Execute This Then New Form Will Appeared..
private void button1_Click(object sender, EventArgs e)
{
string ss = comboBox1.SelectedItem.ToString();
if (ss.Equals("ShutDown"))
{
Process.Start("ShutDown.exe", "_s_t_00");
}
else
{
Process.Start("ReStart.exe", "_r_t_00");
}
}
推荐答案
以这种方式尝试
Try in this way
ProcessStartInfo startInfo = new ProcessStartInfo("ShutDown.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = "_s_t_00";
Process.Start(startInfo);
加油!
Cheers!
尝试在参数中使用-f
.
这将强制关机.
警告-这将关闭所有未保存的程序,所有数据都将丢失.
Try using-f
in your parameters.
This will force a shutdown.
Warning - this will close all unsaved programs and all data will be lost.
这篇关于Windows 7在GUI中关闭代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文