标题: 等待某一时刻的批命令
[打印本页]
作者: jjchen
时间: 2007-5-14 22:51
标题: 等待某一时刻的批命令
我今天在一本很古老的书上看了这么一段等待到指定时间然后在执行其他命令的批文件,与大家分享一下.
@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
作者: ttyp
时间: 2007-5-15 09:34
循环做的?耗CPU啊,不过DOS下只能这么做呵呵,WIN2K+可以用AT啊,不过要启动相应的服务也是麻烦
作者: tttest
时间: 2007-5-15 10:47
还有别的思路吗?这么做的话,始终占有不放的话,耗的很