By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,751 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Running dos commands!

P: n/a
I want to execute a html file named hai.html in c:\mydocuments folder.
How can i open this file in Internet explorer or netscape?
thank you in advance ,
vishnu
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
As to run dos commands you can simply write:

Process p = Runtime.getRuntime().exec("<<command>>");

As to view an html file in IExplorer or Netscape I think you can
just write "filename.html" in the exec String parameter because
the System under the VM automatically find the best program to
execute that file extension. So if IE is the "default browser" IE
will be opened; if Netscape do, Netscape will be opened.
Anyway "nomefile.html" will be shown!

Regards.
Luca Paganelli

"vishnu mahendra" <vi*************@yahoo.com> wrote in message
news:c2*************************@posting.google.co m...
I want to execute a html file named hai.html in c:\mydocuments folder.
How can i open this file in Internet explorer or netscape?
thank you in advance ,
vishnu

Jul 17 '05 #2

P: n/a
On 1/18/04 2:41 AM, in article 0r*******************@tornado.fastwebnet.it,
"Luca Paganelli" <as*@me.it> wrote:
As to run dos commands you can simply write:

Process p = Runtime.getRuntime().exec("<<command>>");


With regards to opening a document on a Windows platform, it is better to
use the "start" command, and pass the html file as an argument. Like:

Process p = Runtime.getRuntime().exec("start myfile.html");

Off hand, I'm not sure if you need to pass the whole path to start or not.
You could probably also use the environment variables in the string, like
%SYSTEM_ROOT%, if I remember correctly.
Anthony

--
Got a blog? Post it:
http://www.martin-studio.com/weblog-index/

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.