System.Diagnostics.Process.Start("c:\\cmd.exe", @"shutdown -s -t 60");

解决方案 »

  1.   

    System.Diagnostics.Process.Start("cmd.exe", @"shutdown -s -t -f 60");
      

  2.   

    直接调用Shutdown就可以了吧
    System.Diagnostics.Process.Start("shutdown", @" -s -t 60 -f");
      

  3.   


    我用这个  只出现了个DOS窗口, 却没执行后面的关机命令啊。
      

  4.   

    直接调用Shutdown就可以了吧 
    System.Diagnostics.Process.Start("shutdown", @" -s -t 60 -f");
      

  5.   

    直接调用Shutdown就可以了吧 
    System.Diagnostics.Process.Start("shutdown", @" -s -t 60 -f");
      

  6.   

    同上
    确实直接调用shutdown就可以了
      

  7.   


    这是一种方法楼主如果要使用cmd,是这样的:
    Process.Start("cmd","/c shutdown -s -t 0");
    自己看看cmd的帮助吧 (cmd /?)
    /c表示调用完成后关闭cmd窗口
    /k表示不关闭
      

  8.   

    System.Diagnostics.Process.Start("shutdown", @" -s -t 60 -f");
      

  9.   

      ExitWindowsEx(0, 0); 
      

  10.   

     
    [DllImport("user32.dll", EntryPoint = "ExitWindowsEx", CharSet = CharSet.Ansi)]   //关闭计算机 
            public void closepc() 
            { 
                //创建访问控制本地系统进程的对象实例 
                System.Diagnostics.Process myprocess = new System.Diagnostics.Process(); 
                myprocess.StartInfo.FileName = "cmd.exe"; 
                myprocess.StartInfo.UseShellExecute = false; 
                myprocess.StartInfo.RedirectStandardInput = true; 
                myprocess.StartInfo.RedirectStandardOutput = true; 
                myprocess.StartInfo.RedirectStandardError = true; 
                myprocess.StartInfo.CreateNoWindow = true; 
                myprocess.Start(); 
                myprocess.StandardInput.WriteLine("shutdown -s -t 0"); 
            } 
      

  11.   

    System.Diagnostics.Process.Start("shutdown", @" -s -t 0 -f");