Read file repeatedly

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
xuriguera
Posts: 1
Joined: 16 Sep 2008 07:15

Read file repeatedly

#1 Post by xuriguera » 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:

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

Post Reply