真是见鬼啊! 当年在学校写的一个破程序,竟然被到处转,nnd。。。。。。。。

java 代码
  1. import java.io.IOException;  
  2.   
  3. public class CtrWDS {  
  4.   
  5.     private static CtrWDS ourInstance = null;  
  6.   
  7.     private CtrWDS() {  
  8.     }  
  9.   
  10.     public static CtrWDS getInstance() {  
  11.         if (ourInstance == null) {  
  12.             ourInstance = new CtrWDS();  
  13.         }  
  14.         return ourInstance;  
  15.     }  
  16.   
  17.     public void exec(String cmd) {  
  18.         try {  
  19.             Runtime.getRuntime().exec("shutdown "+cmd);  
  20.         }   
  21.         catch (IOException e) {  
  22.             System.out.println("执行失败");          
  23.         }  
  24.     }  
  25.   
  26.     public void shutdown() {  
  27.         exec("shutdown -S ");  
  28.     }  
  29.   
  30.     public void restart() {  
  31.         exec("shutdown -R ");  
  32.     }  
  33.   
  34.     public void logout() {  
  35.         exec("shutdown -L ");  
  36.     }  
  37.   
  38.     public static void main(String[] str) {  
  39.         if (str.length == 0) {  
  40.             System.out.println("-----------------------\n" +  
  41.                     "关机  -s\n" +  
  42.                     "重起  -r\n" +  
  43.                     "注销  -l\n" +  
  44.                     "-----------------------\n");  
  45.         }   
  46.         else{  
  47.            try{  
  48.                 CtrWDS.getInstance().exec(str[0]);  
  49.                 Thread.currentThread().sleep(10000L);  
  50.             }  
  51.             catch(Exception e){  
  52.                //CtrWDS.getInstance().exec(str[0]);  
  53.             }  
  54.          }  
  55.     }  
  56. }   
评论
发表评论

您还没有登录,请登录后发表评论

betafox
搜索本博客
我的相册
B41786bd-fc4e-34cf-877b-9bc65e69e98a-thumb
翀儿
共 4 张
最近加入圈子
存档
最新评论