Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|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

1 Answer 1

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
share|improve this answer
    
thank you very much –  waqas Oct 27 '11 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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