일부 배치 연습을하고 있으며 뒤로 이동하여 110에서 100까지 숫자를 계산하려고하지만 짝수 만 계산합니다. 거의 작동하도록 만들었지 만 for 루프가 돌아갈 때마다 totalCount가 업데이트되지 않습니다. 마지막에는 단순히 루프의 마지막 숫자 인 100
으로 합계를 인쇄합니다. 내가 도대체 뭘 잘못하고있는 겁니까?For Loop on Windows Batch
::echo off
setlocal enableextensions
setlocal enabledelayedexpansion
set /a totalCount = 0
for /l %%x in (110, -2, 100) do (
set /a totalCount = %totalCount% + %%x
)
echo total is %totalCount%