内容目录
1.定时关机/重启
shutdown -s -t 3600 #一小时后关机,3600改为自己需要的秒数
at 12:00 shutdown -s #设置某个时间点关机
shutdown -a #取消定时关机/重启
注:-s关机,-r重启,-t 后面接时间,单位是秒,将-s改为-r即可定时重启
2.定时休眠
powercfg -h on
schtasks /create /tn my-sleep /tr "rundll32.exe powrprof.dll,SetSuspendState" /sc once /st 22:22 #在22:22点休眠
schtasks /delete /tn my-sleep #取消定时任务
注:休眠需开启才可以定时休眠,查看休眠是否开启:powercfg /a
3.定时睡眠
powercfg -h off
schtasks /create /tn my-sleep /tr "rundll32.exe powrprof.dll,SetSuspendState" /sc once /st 22:22 #在22:22点睡眠
schtasks /delete /tn my-sleep #取消定时任务
在powercfg -h on状态下,以管理员身份运行rundll32.exe powrprof.dll,SetSuspendState 0,1,0不会进入睡眠,而是休眠。