Running dos commands!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishnu mahendra

    Running dos commands!

    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
  • Luca Paganelli

    #2
    Re: Running dos commands!

    As to run dos commands you can simply write:

    Process p = Runtime.getRunt ime().exec("<<c ommand>>");

    As to view an html file in IExplorer or Netscape I think you can
    just write "filename.h tml" 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.h tml" will be shown!

    Regards.
    Luca Paganelli

    "vishnu mahendra" <vishnu_mahendr a@yahoo.com> wrote in message
    news:c24d8b9.04 01180144.5e6123 ab@posting.goog le.com...[color=blue]
    > 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[/color]


    Comment

    • Anthony Martin

      #3
      Re: Running dos commands!

      On 1/18/04 2:41 AM, in article 0rtOb.46625$Jw2 .40468@tornado. fastwebnet.it,
      "Luca Paganelli" <ask@me.it> wrote:
      [color=blue]
      > As to run dos commands you can simply write:
      >
      > Process p = Runtime.getRunt ime().exec("<<c ommand>>");
      >[/color]

      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.getRunt ime().exec("sta rt 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:


      Comment

      Working...