The list of parameters of restarting the computer

The success of restarting the computer (http://www.cnblogs.com/wangsaokui/archive/2004/05/17/9795.aspx)  [VC++.NET]

publick class Test
{    
    publick static void main()
    {
        ProcessStartInfo startinfo = new ProcessStartInfo();   
        startinfo.UseShellExecute = false;
        startinfo.RedirectStandardOutput = true;
        startinfo.CreateNoWindow = false;
        startinfo.FileName = "shutdown.exe";
        startinfo.Arguments = "/r";
       //set other parameter can realize shutdown......
       Process.Start(startinfo);
    }


The list of the parameters:[-i |-l|-s |-r |-a] [-f] [-m [\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy] 
        
        -i 显示图形界面的对话框。
  -l 注销当前用户,这是默认设置。
  -m ComputerName优先。
  -s 关闭计算机。
  -r 关闭之后重新启动。
  -a 中止关闭。除了-l 和ComputerName 外,系统将忽略其它参数。在超时期间,您只可以使用-a。
  -f 强制运行要关闭的应用程序。
  -m [\\ComputerName] 指定要关闭的计算机。
  -t xx 将用于系统关闭的定时器设置为 xx 秒。默认值是20秒。
  -c "message" 指定将在“系统关闭”窗口中的“消息”区域显示的消息。最多可以使用127 个字符。引号中必须包含消息。
  -d [u][p]:xx:yy 列出系统关闭的原因代码。

Example:

        1、注销当前用户
  shutdown - l
  该命令只能注销本机用户,对远程计算机不适用。

  2、关闭本地计算机
  shutdown - s

  3、重启本地计算机
  shutdown - r

  4、定时关机
  shutdown - s -t 30
  指定在30秒之后自动关闭计算机。

        5、取消定时关机
        Shutdown – a 取消上述关机操作。

注:远程启动时涉及到用户权限的问题,一般用户登陆远程计算机的是guest身份,而重新启动计算机需要administrator身份,解决的方法是在远程计算机上改变guest用户的权限即可!        

posted on 2004-10-14 12:59  .NET Run  阅读(168)  评论(0)    收藏  举报

导航