I have a problem about variable in variable
( the code is below ) :
set a=1
set b=a
echo %%b%%
The expected result is :
set a=1
set b=a
call echo %%%b%%%
And this will work faster:
@echo off
set a=1
set b=a
setlocal enableDelayedExpansion
echo !%b%!
endlocal
And just in case you need to do this within brackets context (e.g. if
, for
...) :
@echo off
set a=1
set b=a
setlocal enableDelayedExpansion
(
for /f %%v in ("%b%") do echo !%%~v!
)
endlocal