Results 1 to 3 of 3
  1. #1
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

    Default excute cmd command

    how can i execute cmd command and show the result on cmd window

    i make

    Java Code:
    Process proc = rt.exec("ping localhost");
    i want execute this command on cmd window and the use see the result on it

  2. #2
    Debugger is offline Member
    Join Date
    Jan 2011
    Posts
    27
    Rep Power
    0

    Default

    Ok, the way i did this for a project before was using runtime

    Runtime.getRuntime().exec(cmd + command );

    where cmd is the string "cmd.exe /c start"
    and command is the string "ping localhost"

    I tested this and it works with the small program i had.

  3. #3
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

Similar Threads

  1. excute cmd command
    By jperson in forum New To Java
    Replies: 4
    Last Post: 11-11-2010, 03:00 PM
  2. excute command
    By jperson in forum New To Java
    Replies: 4
    Last Post: 07-13-2010, 08:48 AM
  3. Does the JRE come with command to run?
    By gotenks05 in forum New To Java
    Replies: 5
    Last Post: 10-25-2008, 12:00 AM
  4. command
    By dirtycash in forum New To Java
    Replies: 8
    Last Post: 01-02-2008, 07:52 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •