Convert string to integer in batch file
1 answer
Don't add commas.
set var=13145
And also when assigning to a variable, don't put it around %
set /a var=%var% + 5 (Or simply set /a var += 5)
Test:
@echo off
set var=13145
set /a var=%var% + 5
echo %var%
Output:
13150
Update
Another solution is to remove these commas with replacement:
set var=13,145
set /a var=%var:,=% + 5
+4
source to share