Page 1 of 1

How do I set a variable string as a variable?

Posted: 04 Jun 2017 12:02
by TheHunterManX
I want to do the following:

Code: Select all

@echo off
set Input=Test
set /P Input=Type the var you want to set to 5(type nothing for Test):
call :Test %Input%
:Test
set %Input%=5
echo %Test%
pause
exit /b 0

This is an example, the file I'm working on has a LOT more call commands like the example. Is there a way for me to set the string as a variable?

Re: How do I set a variable string as a variable?

Posted: 04 Jun 2017 14:07
by aGerman
I don't even understand your example :? so I can only guess ...

Code: Select all

@echo off
set "Test=Input"
set /P "Input=Type the var you want to set to 5: "
set "%Input%=5"
echo %Test%
call echo %%%Test%%%
call call echo %%%%%%%Test%%%%%%%
pause

Steffen