33,311
社区成员
发帖
与我相关
我的任务
分享
@echo off
set strlen=0
set str=%1
:next1
if not "%str%"=="" (
set /a strlen+=1
set str=%str:~1%
goto next1
)
if not "%strlen%"=="5" goto use
set mh=%1
set mh=%mh:~2,1%
if not "%mh%"==":" goto use
set hh=%1
set hh=%hh:~0,2%
if %hh% lss 0 goto use
if %hh% gtr 23 goto use
set mm=%1
set mm=%mm:~3,2%
if %mm% lss 0 goto use
if %mm% gtr 59 goto use
echo Power Off at %1. Close me to cancel
title %2 %1 自动关机 %3
:bbb
set hhmm=%time:~0,5%
if %hhmm%==%1 goto shut
delay_s.exe 10>nul
goto bbb
:shut
psshutdown.exe -k %3
goto end
:use
echo %0 hh:mm [note] [-f]
:end
@echo off
title 定时关机
color B1
rem 设置关机时间 time
echo 请输入关机时间,单位为分钟
set /p input=
set /a time=input*60
shutdown -s -t %time%
echo 设置完成,系统将在%input%分钟后自动关闭
echo 输入cancel并回车可立即取消关机命令,其它则退出CMD窗口
set /p input=
if {%input%}=={cancel} shutdown -a