1.

Solve : Multiple commands in for loop?

Answer»

I want to know if there is any way of executing multiple commands in a for loop in a batch file.

So far I have the following:
SET /A i = "0"
for %%x in (*.JPG) do set /A i = "i + 1" echo !i!

However, I get 'Missing Operator' rather than the value of i. The set command executes fine as if I add the line
echo %i%
at the end of the batch file, 4 (the number of files in the directory) is echoed to the screen.

Any help WOULD be greatly appreciated,

Thanks



Discussion

No Comment Found