Computer Hope

Microsoft => Microsoft DOS => Topic started by: Salv Caruso on August 31, 2004, 11:50:34 AM

Title: Multiple commands in for loop
Post by: Salv Caruso 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