Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java application to run a batch file

Status
Not open for further replies.

lhugh

MIS
May 21, 2000
115
CA
I need to run a batch file (test.bat) in c:\windows\test.bat

I would like to create a Java application to run my above batch file. Is it possible?
 
[For the future] This should really be posted in the J2SE forum forum269 , as this one is for J2EE really. Anyway,

Code:
Process p = Runtime.getRuntime().exec("C:/windows/test.bat")
int exitCode = p.waitFor();
if (exitCode != 0) throw new IOException("Native shell call exited with a non-zero value : " +exitCode);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top