package util.rest;
/**
* java 关机程序
* Created by sheng on 2017/7/22.
*/
public class Shutdown {
/**
* 关机分钟
* @param s
*/
public static void closeComputer(int s){
s*=60;
Runtime rt=Runtime.getRuntime();
String cmddir="cmd /c shutdown -s -t "+s;
try{
rt.exec(cmddir);
System.out.println("电脑将在"+s/60+"分钟后关闭");
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args)
{
closeComputer(60);
}
}