For /f loop in batch comprehension -


its easy (or should) have comprehension problem.
however:
have simple file 2 numbers in 0 , 1

and snippet:

set adp= /f %%i in (file.txt) ( set adp=%%i call :test ) :test  echo adp %adp% 

so expect result
adp 0
adp 1

but

adp 0
adp 1
adp 1

why 3 results instead of two?

because batch file goes :test after loop, no matter what.

you should :

set adp= /f %%i in (file.txt) (   set adp=%%i   call :test ) goto :end  :test  echo adp %adp%  :end 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -