Home / Microsoft / Microsoft DOS / Multiple commands in for loop
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Multiple commands in for loop  (Read 1597 times)
Salv Caruso
Guest
« 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
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / Multiple commands in for loop « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.073 seconds with 18 queries.