Shutdown Windows with Java

后端 未结 4 1280
清歌不尽
清歌不尽 2020-12-16 19:02

Is it possible to shutdown Windows programmatically with Java?

Cheers

4条回答
  •  死守一世寂寞
    2020-12-16 19:56

    If you want to shutdown it in certain time append -t parameter (in seconds).

    For five seconds:

    String shutdownCmd = "shutdown -s -t5";
    

提交回复
热议问题