小白求问啊
net吧
全部回复
仅看楼主
level 1
写了个定时关机的程序,但是有点问题
2016年09月13日 06点09分 1
level 1
求大神指点迷津啊
2016年09月13日 06点09分 4
level 1
如果不关闭当前窗口,可以正常设置系统关机时间
2016年09月13日 06点09分 5
level 1
Thread.Sleep(1 * 1000);
var startInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe");
startInfo.UseShellExecute = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow = false;
var myProcess = new System.Diagnostics.Process();
myProcess.StartInfo = startInfo;
myProcess.Start();
myProcess.StandardInput.WriteLine("shutdown -s -t " + 10000);
Console.WriteLine(startInfo);
2016年09月13日 06点09分 6
level 1
调用这段代码前,通过this.close()关闭了当前窗口
2016年09月13日 06点09分 7
1