Aqui está algo que eu criei, eu não testei nada disso, mas dou um giro, como se fosse loop até que você o mate:
@echo off
:: Setting max_count to '0' makes this an infinite loop, you can set it to 10000000 if you want or leave it at 0
set max_count=0
:: Location where the .sas files are stored; '.' means current directory
set sas_dir=.
:: counter should be '0'
set counter=0
:: Starting the loop
:start_loop
set /a counter+=1
:: Looking for .sas files to execute
if exist "%sas_dir%\*.sas" for /f "tokens=1* delims=" %%f in ('dir /b /o:n /a:-d "%sas_dir%\*.sas"') do (
echo INFO: Running %%f
call "C:\Program Files\SASHome2-94\SASFoundation.4\sas.exe" -sysin "%%~pnxf"
rename "%%~pnxf" "%%~pnf.done"
)
:: Stats
echo INFO: Looped Count: %counter%; Reloop Time: 15 secs
:: Waiting 15 secs to reloop
timeout /t 15 >nul
:: Checking Max Counter
if "%max_count%"=="%counter%" (
echo INFO: Looping completed with "%max_count%" counts, exiting...
goto end
)
:: relooping
goto start_loop
:end
Este é um site que achei ser informativo sobre for
loops e outras perguntas relacionadas a lotes: link