RosettaCodeData/Task/Dynamic-variable-names/Batch-File/dynamic-variable-names.bat

15 lines
315 B
Batchfile
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
@echo off
setlocal enableDelayedExpansion
set /p "name=Enter a variable name: "
set /p "value=Enter a value: "
::Create the variable and set its value
set "%name%=%value%"
::Display the value without delayed expansion
call echo %name%=%%%name%%%
::Display the value using delayed expansion
echo %name%=!%name%!