REM 批处理模拟Linux中watch命令
@echo off
color 1f
:CheckVar1
if {%1} equ {} (goto Help) else goto CheckVar2
:Help
echo %0 [time] [command]
echo.
goto End
:CheckVar2
if {%1} equ {} (goto Help) else goto OK
:OK
echo WScript.sleep 1000*%1>%temp%/sleep.vbs
For /L %%t in (1,1,-1) Do goto Execute
:Execute
SET LASTTIME=%DATE:~4,10% %TIME%
cls
echo Every %1s: %2 Last run at: %LASTTIME%
echo.
cmd /c %2
echo.
echo.
echo Every %1s: %2 Last run at: %LASTTIME%
cscript /NoLogo %temp%/Sleep.vbs %1>nul
goto OK
:End
del /q %temp%/sleep.vbs