Multiple commands inside a DO LOOP
Posted on 2004-10-04
I'm trying to write a batch file that writes another file that is based on two things: 1) A list of files 2) a Count
I want the batch file to list files of a certain type (.jpg in this intsnace) and then write those files to a temporary file. Then, line by line, read in those file names and write them to another file with an incremented number.
dir *.jpg /b > files.txt
- Writes a list of jpg files to files .txt
for /F "DELIMS=" %%F IN (files.txt) DO (Echo %%F %count >> %1.txt)
- Writes a line to my file (given by %1) containing a file name (from DIR command earlier) and a count.
I can't see how to facilitate a "Count" variable in this DO loop as I don't know how to do multiple commends inside the paraentheses.
I guess I need to use "SET /A COUNT=COUNT+1", but I can't see where or how as I only seem to be able to do one thing in the DO() bit.