首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

java调用 关机命令,如何写正确

2012-02-04 
java调用 关机命令,怎么写正确?RuntimertRuntime.gettime()Stringcmd c:\\windows\\system32\shatdown

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

热点排行