如何创建一个不经常重新循环的脚本来检查是否启用了更改?
:0
SET CHANGES=<CHECK.TXT
:1
IF %CHANGES% GTR 0 GOTO DONE
(TIMEOUT /T 1 >NUL)
GOTO 1
:DONE
ECHO CHANGES ENABLED: %CHANGES%
PAUSE >NUL
谢谢!
答案 0 :(得分:0)
完成编辑(我误解了你的问题):
@echo off
for %%i in (t.t) do set oldstamp=%%~ti
:loop
for %%i in (t.t) do set newstamp=%%~ti
if not "%newstamp%"=="%oldstamp%" goto :done
timeout /t 1 >nul
goto :loop
:done
echo file has changed