日期:2014-05-20  浏览次数:20557 次

java调用 关机命令,怎么写正确?


Runtime   rt=Runtime.gettime();
String   cmd= "c:\\windows\\system32\shatdown.exe "
rt.exc(cmd);

这样写有什么错误

------解决方案--------------------
Runtime rt=Runtime.gettime();
String cmd= "c:\\windows\\system32\\shatdown.exe "
rt.exec(cmd);
---------------------
我要没记错的话.应该是shutdown.exe 而非shatdown.exe
而且单纯的shutdown.exe 是无法关机的.
需要添加参数
比如10s关机的话.应该是
shutdown -s -t 10