Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Multiple commands in for loop  (Read 5703 times)

0 Members and 1 Guest are viewing this topic.

Salv Caruso

  • Guest
Multiple commands in for loop
« on: August 31, 2004, 11:50:34 AM »
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