N/APosted on - 10/30/2011
I have a script like this one below. My aim is to add 1 to variable count in each iteration of the for loop. So, if temp.txt has 10 lines, count will be 10 finally.
for /f "eol=v" %%f in (temp.txt) do (
set /A count = %count% + 1
But I always get count value is 1. I know the statement "set /A count = %count% + 1" is not correct but don't know how to fix it.
I would appreciate insight.
How to use expression for a loop?
In which language are you creating your program? Is it C, C++, java or what? Because what I know about setting counts is that there must be a use the -while do- or -do while function somewhere in the code, especially if the language that you are using is java or C++.
The while do function will enable for an increment to be performed as you want once a number functions that you will have declared will have been met.
You can watch more about the -while do loop here:
, and read more about it here: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html