I am trying to copy the line below to a new text file using a batch file. The line is given below:

objIEA.Navigate "http://"&WScript.Arguments(0)&"/video?session=3&alphabet=83&channel="&WScript.Arguments(1)&"&profile="& WScript.Arguments(2)

What I did is something like this and I am getting an error while executing the batch file.

ECHO objIEA.Navigate "http://"&WScript.Arguments(0)&"/video?session=3&alphabet=83&channel="&WScript.Arguments(1)&"&profile="& WScript.Arguments(2) > test.txt

The new file will have a .vbs extension, but it is not even working for test.txt.

link|improve this question
terrible, you should've done a bit of troubleshooting to narrow it down, then you'd have seen it was the ampersands that were the issue, and you could've asked it in simpler form with a clearer example focusing on the ampersands. very poor work there. – barlop Oct 27 '11 at 17:28
feedback

1 Answer

up vote 1 down vote accepted

It's the ampersands that are causing the problem (they're interpreted as special characters)

You can escape these out with the caret '^'

e.g. this works:

ECHO objIEA.Navigate "http://"^&WScript.Arguments(0)^&"/video?session=3&alphabet=83&channel="^&WScript.Arguments(1)^&"^&profile="^& WScript.Arguments(2) > test.txt
link|improve this answer
thank you very much – waqas Oct 27 '11 at 17:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.