I am doing some batch practice and I am trying to do a loop to go backwards and count the numbers from 110 to 100, but only the even numbers. I almost got it to work, but for so
Try changing %totalCount% to !totalCount!. Therefore, the code should look like this:
echo off
setlocal enabledelayedexpansion
set /a totalCount = 0
for /l %%x in (110, -2, 100) do (
set /a totalCount = !totalCount! + %%x
)
echo total is !totalCount!