pCan anyone explain why SET is not doing anything in the following code?:
ECHO OFF
FOR /L %%b IN (-1,1,1) DO (
SET /A _lat=%%b
ECHO variable lat: %_lat%
ECHO variable b: %%b
ECHO:
)
output:
variable lat:
variable b: -1
variable lat:
variable b: 0
variable lat:
variable b: 1
I tried SET without /A of course, I tried that within FOR where variable %%b was a string from a file and it worked normally, but just here when variabl %%b is a changing number it does not work.
If you would have any suggestion, please tell me. Of couse I can use just %%b to diplay what I want, but since this is a part of larger scritp, to make it more readable, I would like to but the vaules to approproate variable.
You need to use
ENABLEDELAYEDEXPANSION. Try with the below: