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?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With