| 1. |
Solve : Write < and > to a file with batch? |
|
Answer» Hi there >>test.xml echo this will appear in file ^<TEST1^>This is a test^</test1^> This solved my problem. Thank you so much for your quick help, contrex Cheers and greets You're welcome. When I wrote "... if you want them to show up in files" of COURSE I should have added "or on the screen"I have another question, if u don't mind I'd like to somehting like this Code: [Select]@echo off set towrite=test (this is just a simple example, in my batch it reads from a file etc and then the batch sets towrite=test) >>test.xml ^<%towrite%^> pause So, I'd like to write my towrite between the < > tags, how do I do that? Code: [Select]@echo off set test=test >>test.xml ^<^%test^%^> pause The above code doesn't workYour code @echo off set test=test >>test.xml ^<^%test^%^> pause 1. You have set the environment variable named test to hold the string "test". 2. A SIDE issue - it can lead to bad confusion if you call variables the same as their contents. 3. You missed out "echo" in your third line which should look like this I guess >>test.xml echo ^<^%test^%^> 4. However this will result in nothing being written to test.xml since you have escaped the % signs surrounding the variable name. 5. If you remove the carets in front of the % signs >>test.xml echo ^<%test%^> test.xml holds this line <test> 6. If you escape the % signs you no longer have a variable. |
|