I would like to add the simpliest tag into a file, using a CMD batchfile, but it seems that the double quotes are spoiling the party:
From other StackOverflow posts I am aware of the double quote state machine and the usage of ^" (^ as an escape character). Still I can't make it work:
Hereby my attempts (with their results):
C:>echo <tag variable="value"> // very na?ve
The syntax of the command is incorrect.
C:>echo "<tag variable="value">" // let's use quotes for delimiting the string
"<tag variable="value">"
C:>echo "<tag variable=^"value^">" // let's use the escape character
The system cannot find the path specified.
C:>echo "<tag variable=^"value^"> // what if the state machine is not switched back?
The syntax of the command is incorrect.
C:>echo "<tag variable=^"value"> // desperate people do weird things :-)
"<tag variable=^"value">
I have also done some tests using the escape character in front of the tag characters < and > (as those have their own significance in CMD) but also there no good results.
Also first putting the entry within a variable (set test="..."
) does not solve the issue.
As mentioned, I am getting desperate. The only thing I want to do is writing this into a text file:
<tag variable="value">
Can anybody help me out here?
Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…