try {
Runtime.getRuntime().exec("cmd /c shutdown -s -f");
} catch (IOException e) {
e.printStackTrace();
}
怎么老弹出关机警告窗口呢?

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【cooc123】截止到2008-06-28 22:29:19的历史汇总数据(不包括此帖):
    发帖数:115                发帖分:1490               
    结贴数:36                 结贴分:740                
    未结数:79                 未结分:750                
    结贴率:31.30 %            结分率:49.66 %            
    楼主该结一些帖子了
      

  2.   

    shutdown 是windows内部命令,好像java不能调用
      

  3.   

    shutdown 是windows内部命令,好像java不能调用
      

  4.   

    Runtime.getRuntime().exec("shutdown   /s")  
      

  5.   

    你用cmd   /c   这样就不会出现窗口。其实是打开运行后自动关闭
    Usage:   shutdown   [-i   |   -l   |   -s   |   -r   |   -a]   [-f]   [-m   \\computername]   [-t   xx]   [-c   "c  
      omment"]   [-d   up:xx:yy]  
       
                      No   args                                   Display   this   message   (same   as   -?)  
                      -i                                             Display   GUI   interface,   must   be   the   first   option  
                      -l                                             Log   off   (cannot   be   used   with   -m   option)  
                      -s                                             Shutdown   the   computer  
                      -r                                             Shutdown   and   restart   the   computer  
                      -a                                             Abort   a   system   shutdown  
                      -m   \\computername               Remote   computer   to   shutdown/restart/abort  
                      -t   xx                                       Set   timeout   for   shutdown   to   xx   seconds  
                      -c   "comment"                         Shutdown   comment   (maximum   of   127   characters)  
                      -f                                             Forces   running   applications   to   close   without   war  
      ning  
                      -d   [u][p]:xx:yy                   The   reason   code   for   the   shutdown  
                                                                      u   is   the   user   code  
                                                                      p   is   a   planned   shutdown   code  
                                                                      xx   is   the   major   reason   code   (positive   integer   less   than   256)  
                                                                      yy   is   the   minor   reason   code   (positive   integer   less   than   65536)
      

  6.   


    我是用的 cmd /c 啊