Re: DOS Dynamic Variable Naming


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by 20080426 on April 26, 2008 at 03:56:20:

In Reply to: DOS Dynamic Variable Naming posted by drumsticks on April 25, 2008 at 15:24:20:

: Is it possible to create a variable name from the value of another variable, such as like a utopian example below (I don't think an EVAL function exists):

: SET variableOne=variableTwo

: SET EVAL(variableOne)=example Text

: %variableTwo%

: Thanks for any input or direction!

##

Yes, try this:

---[cut here]---
@echo off
echo Command: set VariableOne=VariableTwo
set VariableOne=VariableTwo
echo Results: VariableOne=%VariableOne%
echo.
echo Command: set %%VariableOne%%=Example Text
set %VariableOne%=Example Text
echo Results: VariableTwo=%VariableTwo%
---[cut here]---


Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]