Sign in with
Sign up | Sign in
Your question

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

Last response: in Windows XP
March 30, 2010 10:14:17 PM

i want to output this line to another batch file but have the variable name output exactly as it is.

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 

Best solution

March 31, 2010 8:56:47 PM

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!
December 22, 2011 12:02:41 AM

Best answer selected by RecoJohnson.