The relevant code for that is
Code: Select all
set var=4
set /p a=
echo %a%
However, when I change it to this, it works
Code: Select all
set var=4
set a=%var%
echo %a%
Moderator: DosItHelp
Code: Select all
set var=4
set /p a=
echo %a%
Code: Select all
set var=4
set a=%var%
echo %a%
Code: Select all
set var=4
set /p a=
call echo %a%
Code: Select all
4
Code: Select all
@echo off &setlocal
set var=4
set /p "a=Enter a variable name: "
echo Entered: %a%
:: assign the value of var to the entered name
set "%a%=%var%"
:: either use call ...
call echo %a%=%%%a%%%
:: ... or delayed expansion
setlocal EnableDelayedExpansion
echo %a%=!%a%!
endlocal
pause
Code: Select all
Enter a variable name: X
Entered: X
X=4
X=4
Drücken Sie eine beliebige Taste . . .
Code: Select all
4
Code: Select all
%var%