Reputation: 31
I'm trying to write a batch which extracts a value of a parameter from an ini file. The problem is that this for loops iterates twice:
call:ini DW_LOADER_FeedsRootDir UDM_Folder
:ini
for /f "tokens=2 delims==" %%U in ('find "%~1=" DW_environmentConfig.ini') do (
set %~2=%%U
)
the batch does not end after this line, and all the commands that follow it are also repeated twice. I can't use a command like 'goto:eof' after the loop. Does anyone has an idea as to why this happens?
Upvotes: 3
Views: 2188
Reputation: 3122
When you use CALL:INI
the batch calls your function, and when it ends, it returns to CALL
command point, then it goes to :ini
label again.
Try it:
call:ini DW_LOADER_FeedsRootDir UDM_Folder
goto:eof
:ini
for /f "tokens=2 delims==" %%U in ('find "%~1=" DW_environmentConfig.ini') do (set %~2=%%U)
Upvotes: 5