import java.io.IOException;
public class test6 {
public static void main(String[] args) throws IOException {
// 运行cmd命令
// shutdown 关机
// 加上参数才能执行
// -s 默认在1分钟之后关机
// -s -t 指定时间 指定关机时间
// -a 取消关机操作
// -r:关机并重启
// 例如:设置1小时后关机
Runtime.getRuntime().exec("shutdown -s -t 18000");
// 取消关机
Runtime.getRuntime().exec("shutdown -a");
}
}
Rufen Sie die CMD-Einstellungen zum Herunterfahren auf
Supongo que te gusta
Origin blog.csdn.net/weixin_43959436/article/details/132134935
Recomendado
Clasificación