Read file repeatedly
Posted: 16 Sep 2008 07:21
Hi,
I have to write a batch script to check the results of another program. My code looks like this:
Once it works I will replace the timeout with a call to another program that will update the result.log file.
The problem is that %myResult% does not get updated. Any ideas?
My first try was to nest fors directly but it does not work either.
Thanks
I have to write a batch script to check the results of another program. My code looks like this:
Code: Select all
@echo off
Set ids=1,2,3,4,5,6,7
FOR %%i IN (%ids%) DO (
timeout 5
CALL :CheckResult
ECHO ID: %%i Result: %myResult%
)
GOTO :END
:CheckResult
FOR /F "eol=; tokens=* delims=, " %%i in (.\result.log) do @SET myResult=%%i
GOTO :END
:END
Once it works I will replace the timeout with a call to another program that will update the result.log file.
The problem is that %myResult% does not get updated. Any ideas?
My first try was to nest fors directly but it does not work either.
Thanks