midiboy Posted January 11, 2009 Share Posted January 11, 2009 Hi guys,once again, a problem with cmd commands :-) If anyone has a solution, I would very much appreciate it ...Here´s the problem:I need to dynamically create an xml file with a commandline script so I was thinking of using the ECHO command to create that script something like:ECHO This text goes to the new file >C:\Test.xmlECHO Next line >>C:\Test.xmlOnly problem is ... the xml file has symbols in the text that ECHO interprets as commands. Example: this line should go into the xml:<?xml version="1.0" encoding="utf-8"?>Now, how do I do that ? Iif I wrap the whole code into double quotes like this:ECHO "<?xml version="1.0" encoding="utf-8"?>" >C:\Test.xmlthe quotes get written into the xml like this:"<?xml version="1.0" encoding="utf-8"?>"If I don´t do that, ECHO interprets the "<" and ">" symbols as commands and throws an error message.If I use single quotes instead of double quotes, the whole code gets messed up even more. I also tried adding a "\" before the double quotes but this does not help either.Since the whole thing is part of a bigger cmd script, it should not be vbscript or anything else.Does anyone have an idea ??Thanks for your help! Alex Link to comment Share on other sites More sharing options...
midiboy Posted January 11, 2009 Author Share Posted January 11, 2009 Hi again,ah, I should have looked up Technet before posting here, sorry The solution is to add a "^" before each ">" or "<". Bye,Alex Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now