| View previous topic :: View next topic |
| Author |
Message |
Asit Guest
|
Posted: Fri Sep 19, 2003 9:48 am Post subject: Problem in executing batch file(.bat) |
|
|
I have written a java file to execute a batch file (abc.bat) but it is
not executing batch file.
Is there any way to execute batch file.
import java.io.*;
class Test {
public static void main(String[] args) throws IOException {
Runtime.getRuntime().exec("C:\asit\abc.bat");
}
}
abc.bat
--------
set echo on
echo Anil
Regards
Asit
|
|
| Back to top |
|
 |
Nathan Zumwalt Guest
|
Posted: Fri Sep 19, 2003 2:04 pm Post subject: Re: Problem in executing batch file(.bat) |
|
|
Note that Runtime.exec() returns a Process:
[url]http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runtime.html#exec(java.lang.String[/url])
To see your output, you'll need to get the OutputStream from the
Process.
-Nathan
[email]hi_asit (AT) rediffmail (DOT) com[/email] (Asit) wrote in message news:<ed562307.0309190148.4d711445 (AT) posting (DOT) google.com>...
| Quote: | I have written a java file to execute a batch file (abc.bat) but it is
not executing batch file.
Is there any way to execute batch file.
import java.io.*;
class Test {
public static void main(String[] args) throws IOException {
Runtime.getRuntime().exec("C:\asit\abc.bat");
}
}
abc.bat
--------
set echo on
echo Anil
Regards
Asit
|
|
|
| Back to top |
|
 |
|