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

Filburt
  • 17,626
  • 12
  • 64
  • 115
alice
  • 7
  • 2
    `echo !%PROJECT%_VERSION!` or `call echo %%%PROJECT%_VERSION%%` See: https://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990 – Aacini Feb 09 '22 at 13:13

1 Answers1

1

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!
Gerhard
  • 22,678
  • 7
  • 27
  • 43