To get the value of a value of a variable, the “usual” way is to use delayed expansion.
But you can also force a second parsing (“expand an expanded variable”).
You can do that with the call
command (which executes the following command within a second separate process). To pass a literal %
to the second process, escape it with another %
, which explains the strange triple%
.
@echo off
setlocal enabledelayedexpansion
set "string=varname"
set "varname=some text"
echo with delayed expansion: %string% = !%string%!
call echo without delayed expansion: %string% = %%%string%%%
CLICK HERE to find out more related problems solutions.