----------- android培训、java培训、java学习型技术博客、期待与您交流! ------------ import java.io.IOException; public class shutDown { public static void shutDownAtTime(String time){ Runtime run=Runtime.getRuntime(); try { run.exec("at "+time+" Shutdown -s"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void shutDownHaveTime(String time){ Runtime run=Runtime.getRuntime(); try { run.exec("Shutdown.exe -s -t "+time); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void shutDownAtNow(){ Runtime run=Runtime.getRuntime(); try { run.exec("Shutdown.exe -s"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void reboot(){ Runtime run=Runtime.getRuntime(); try { run.exec("Shutdown.exe -r"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void shutDownHaveTimeWithMess(String time,String mes){ Runtime run=Runtime.getRuntime(); try { run.exec("shutdown -s -t "+time+" -c""+mes+"""); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void noShutDown(){ Runtime run=Runtime.getRuntime(); try { run.exec("shutdown -a"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }