java Runtime对象

	public static void main(String[] args) throws IOException {
		
		//返回与当前 Java 应用程序相关的 Runtime 对象
		Runtime runtime = Runtime.getRuntime();
		
		/*
		 * exec 在单独的进程中执行指定的字符串命令。
		 * 这些字符串命令能在dos窗口执行
		 */
		//runtime.exec("shutdown -s -t 300");//300秒后关闭计算机
		
		runtime.exec("shutdown -a");//取消关机

	}

猜你喜欢

转载自blog.csdn.net/xldmx/article/details/88948100
今日推荐