Since batch doesn’t really have ints, I have to work around it with set /a. Here I have a code segment (from a batch) that evaluates a numeric expression and sets it into a string:
@echo off
set test=|set /a 12-10
pause
My problem is that this actually prints the “test” string. This is quite inconvenient because I may need to change the string later. Is there any way around this (besides a whole bunch of cls)?
I believe
is what you’re after – your version doesn’t set
testat all.You can even do indirect assignments like that: