关于调用cmd指令不成功的问题
Process p = new Process();
p.StartInfo.FileName = "C://Windows//System32//cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
//p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine("shutdown /s");
p.StandardInput.WriteLine("exit");
代码里面为什么p.StandardInput.WriteLine("exit");可以成功执行, p.StandardInput.WriteLine("shutdown /s");不能?我换成 p.StandardInput.WriteLine("shutdown -s");结果也是一样,我是用的管理员模式运行的啊,去掉p.StandardInput.WriteLine("exit");后显示的是:
应该表明是管理员模式啊,实在不知道改哪里了~~~~~求帮助 命令提示符 管理 C# --------------------编程问答-------------------- 你试试command下shutdown --------------------编程问答--------------------
cmd里面敲可以用啊! --------------------编程问答-------------------- 自己顶一下·~~~~都来帮帮忙啊~~~~~~~~~~~~~
补充:.NET技术 , C#