When I try to reference this variable in my for loop, it doesn't reference the value correctly. It stays at the value it was set before the loop. I tested that. But it seems that it updates the variable, though. Which makes even less sense to me. I debugged the variable with the "set" command in the loop. And yes, the value updates, but referencing it in the for loop still results in the value.
set /a index=0
for %%f in (*.*) do (
set /a index=index+1
echo index: %index%
)
echo index: %index%`
console output:
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 0
index: 12