Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .