CALL SET %PROJECT%_VERSION=1_7_0
echo %%PROJECT%_VERSION%
The result will be %PROJECT.
How can I let it to 1_7_0
CALL SET %PROJECT%_VERSION=1_7_0
echo %%PROJECT%_VERSION%
The result will be %PROJECT.
How can I let it to 1_7_0
Using delayedexpansion
makes life easier for these types of scenarios.. You do not need to get the number of %
100% either side of the variables and no need to use call
:
@echo off
setlocal enabledelayedexpansion
set "PROJECT=Projectname"
SET "%PROJECT%_VERSION=1_7_0"
echo !%PROJECT%_VERSION!