Results 1 to 2 of 2
  1. #1
    pradeesh is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Question Running batch files thraugh java by passing parameters

    Hi

    I want to run a batch file by passing some parameters.
    Eg: copy.bat "D:\live\hoe.txt" "D:\test"

    while doing this from command prompt its working and i have written some java code for running this batch file.

    String live="D:\\live\\how.txt";
    String test="D:\\test";
    String bat="D:\\copy.bat";
    String[] command = new String[3];
    command[0] = bat;
    command[1] = live;
    command[2] = test;
    try {
    Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    but this time its not copying the file;

    Please help.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

Similar Threads

  1. Batch Files in java
    By coco in forum New To Java
    Replies: 3
    Last Post: 12-05-2008, 02:30 PM
  2. Running batch files in java
    By pradeesh in forum New To Java
    Replies: 10
    Last Post: 12-04-2008, 10:26 PM
  3. passing parameters to paint mtd
    By themburu in forum Java Applets
    Replies: 3
    Last Post: 07-14-2008, 09:15 PM
  4. passing parameters between two applets
    By veena1612 in forum Java Applets
    Replies: 1
    Last Post: 05-27-2008, 10:29 AM
  5. JNI - passing and returning parameters by value
    By java_to_c in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 09:49 PM

Posting Permissions

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