我今天在一本很古老的书上看了这么一段等待到指定时间然后在执行其他命令的批文件,与大家分享一下.
@echo off
if "%1"=="" goto help
if "%1"=="" goto help
set $$$$TIME=is %1
echo waiting for time %1
:loop
echo.|time|find "%$$$$TIME%">nul
if errorlevel 0 if not errorlevel 1 goto ontime
goto loop
:ontime
set $$$$TIME=
rem insert the timed commands below
echo Alarm Alarm Alarm!!!
goto quit
:help
echo pause batch file execution until a specific time is reached.
echo SYNTAX %0 HH:MM[:SS],e,g %0 11:31
:QUITS
@echo off
if "%1"=="" goto help
if "%1"=="" goto help
set $$$$TIME=is %1
echo waiting for time %1
:loop
echo.|time|find "%$$$$TIME%">nul
if errorlevel 0 if not errorlevel 1 goto ontime
goto loop
:ontime
set $$$$TIME=
rem insert the timed commands below
echo Alarm Alarm Alarm!!!
goto quit
:help
echo pause batch file execution until a specific time is reached.
echo SYNTAX %0 HH:MM[:SS],e,g %0 11:31
:QUITS
