Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to escape ampersand in DOS?

843798May 31 2002 — edited Jun 3 2002
I'm using java.lang.Runtime to launch Internet Explorer from my application. The method call is as follows:
Runtime.getRuntime().exec(
        "cmd /c \"C:\\Program Files\\Internet Explorer\\IEXPLORE\""  +
        " http://www.myurl.com/mypage.asp?field1=value1&field2=value2");
The problem here is that dos is interpereting the ampersand as a special character instead of passing it literally into the argument to the IEXPLORE command... so what I get is internet explorer trying to open the site "http://www.myurl.com/mypage.asp?field1=value1". It then waits for the IE window to be closed, then it attempts to execute the command "field2=value2".

I just need to tell dos to escape the meaning of the ampersand! This sounds like a very basic question to me and I can't believe that I haven't been able to find the answer by searching the web.

Hopefully someone here will make me feel like an idiot and tell me how simple it is:)

thanks,
Jay
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2002
Added on May 31 2002
2 comments
321 views