|I have a simple For Loop in a batch file and I can't get my counter to count. I've been looking all over and can't figure out what I'm doing wrong.|
I'm just looking in a folder and running through the list of files. I want to store the file names in variables.
Here's what I have:
set /a counter=0
for /f %%x in ('dir /b /o-d') DO (
set /a counter+=1
When it runs, the first time through it tells me
The next loop it tells me:
So I can tell it's running through but the counter variable just isn't being updated. What am I missing?
I've tried counter+=1, counter=%counter%+1, counter=!counter!+1 and nothing works.