WEB开发网
开发学院WEB开发Jsp windows定时关机程序 阅读

windows定时关机程序

 2008-01-05 20:09:05 来源:WEB开发网   
核心提示:/*** Created by IntelliJ IDEA. * autor:cofbean * Date: 2004-3-10 * Time: 13:41:48 * QQ:21439991 */import java.io.IOException;public class CtrWDS {

/**
  * Created by IntelliJ IDEA.
   * autor:cofbean
   * Date: 2004-3-10
   * Time: 13:41:48
   * QQ:21439991
   */

import java.io.IOException;

public class CtrWDS {

   PRivate static CtrWDS ourInstance = null;

   private CtrWDS() {
     }

     public static CtrWDS getInstance() {
       if (ourInstance == null) {
         ourInstance = new CtrWDS();
        }
       return ourInstance;
      }

   public void exec(String cmd) {
     try {
       Runtime.getRuntime().exec(cmd);
     }
     catch (IOException e) {
       System.out.println("执行失败");    
     }
   }


 public void shutdown() {
     exec("shutdown -S ");
   }

   public void restart() {
     exec("shutdown -R ");
   }

   public void logout() {
     exec("shutdown -L ");
   }

   public static void main(String[] str) {
     if (str.length == 0) {
       System.out.println("-----------------------\n" +
           "关机  -s\n" +

Tags:windows 定时 关机

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接