Jump to content

Recommended Posts

Posted

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.xml
ECHO Next line >>C:\Test.xml

Only 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.xml

the 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


Posted

Hi again,

ah, I should have looked up Technet before posting here, sorry :whistle:

The solution is to add a "^" before each ">" or "<".

:hello:

Bye,

Alex

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...