|Im having trouble resetting values everytime a loop starts. How can I alter the code in s.bat so that the batch rechecks the txt file every single time the loop restarts rather than assuming the text file is still the same? |
Contents of b.txt
contents of s.bat:
for /F "tokens=*" %%A in (b.txt) do (
SET /A vidx=!vidx! + 1
(The 1st line in b.txt gets deleted here)
Everytime the loop restarts, there will be one less line. Problem is everytime the loop restarts it still sets the original four lines as vare1,vare2,vare3,vare4. Because the 4th line gets deleted at the end of the 1st loop, there should no %vare4% because now there are only 3 lines in b.txt and %vare1% should be c:\work\abc.doc but it still shows up as c:\work\2014.doc.