cmd use input as variable -
am trying write batch file take user input , use call list of stored variables.
i have figured out how using if statements, feel there must cleaner way!
what looking this:
set a=1 set p%a%= hello
*this works , can echoed:
echo %p1%
*output: hello
set /p prompt input selection: prompt=1 set var=%prompt% echo %p(!var!)%
*ideally same as:
echo %p1%
or whatever prompt value desired value of %a% cannot part work
prompt=1
should set prompt=1
echo %p(!var!)%
should echo !p%x%!
(with setlocal enabledelayedexpansion
of course)
Comments
Post a Comment