3

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?

1 Answer 1

5

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.