2个回答
展开全部
System.Diagnostics.Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = "cmd.exe";
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.RedirectStandardInput = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.Start();
pro.StandardInput.WriteLine("shutdown/r");//在这位里你需要写入执行命令行。。你的意思没有表达清楚啊
pro.StandardInput.WriteLine("exit");
pro.StartInfo.FileName = "cmd.exe";
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.RedirectStandardInput = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.Start();
pro.StandardInput.WriteLine("shutdown/r");//在这位里你需要写入执行命令行。。你的意思没有表达清楚啊
pro.StandardInput.WriteLine("exit");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询