Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Need write to file %variable%, instead of its "value". Basically what I have:
HTML
@ECHO OFF
SET variable=2
ECHO Some text... > file.bat
ECHO %variable% >> file.bat
ECHO More text.. >> file.bat


WHAT I GET, file.bat:
Some text...
2
More text...

WHAT I WANT, file.bat:
Some text...
%variable%
More text...
Posted
Updated 18-Oct-13 4:00am
v3

1 solution

I found a solution: Instead of %variable%, write %%variable%%.
So in order to display/write one %, write ECHO %%.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Oct-13 10:28am    
5ed.
—SA
thatraja 18-Oct-13 11:19am    
Take a 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900