How do i output a variable reference to another batch file?

recojohnson

Distinguished
Mar 30, 2010
11
0
18,510
i want to output this line to another batch file but have the variable name output exactly as it is.

ex.
echo %testvariable% >> test.bat

That would output whatever the variable is.

But how can i get it to output character for character %testvariable%

"%testvariable" - i want to output the words including the percent signs.

Thanks in Advance :p
 
Solution
Ok... this presented a challenge in obscure batch file scripting (something I haven't had to do in years!

If I understand your stated objective correctly, you want to create a secondary file that contains the literal output of %testvariable%

To do this the command would be:

echo %%testvariable%% >>test.bat

Hope this helps!

digitalprospecter

Distinguished
Mar 31, 2010
786
0
19,060
Ok... this presented a challenge in obscure batch file scripting (something I haven't had to do in years!

If I understand your stated objective correctly, you want to create a secondary file that contains the literal output of %testvariable%

To do this the command would be:

echo %%testvariable%% >>test.bat

Hope this helps!
 
Solution