Reputation: 259
I am trying to make a batch file that will write other files.
This is my file:
@echo off
set x=100
echo %x% >> output.txt
What this does is create a text file called "output.txt".
In this file it will display "100"
This is not what I want it to, I want the file to contain "%x%" literally.
The reason I am trying to do this is because I would like a batch file to create other complex batch files.
I could use copy or move to move another file containing what I want, but I need this to be a single file.
I would really appreciate some help, but it is understandably really difficult to understand.
Thanks Jason
Upvotes: 0
Views: 102
Reputation: 43
Just set x after you create the file:
@echo off
echo %x% >> output.txt
set x=100
This should work because you don't need to set x that early in the program (at least under those circumstances you don't).
Upvotes: 0
Reputation: 17846
Inside a batch file, double up your percent signs:
@echo off
set x=100
echo %%x%% >> output.txt
Upvotes: 2