Two Laptop Bag*
The moose likes Java in General and the fly likes Executing a *.bat file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Executing a *.bat file" Watch "Executing a *.bat file" New topic

Executing a *.bat file

Sameera Abeysinghe
Ranch Hand

Joined: Nov 15, 2004
Posts: 104
Hi all,
Is it possible to execute a *.bat file from inside a java code. If so tell me how.
Thank you
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Yes. Have a look at java.lang.Runtime's exec methods.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Pradeep Kadambar
Ranch Hand

Joined: Oct 18, 2004
Posts: 148
Code will be something like this:

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Executing a *.bat file
Similar Threads
Two JDK on a machine
WA #1.....word association
WSAD 5.0 Test Environment Server and plugin-cfg.xml
WA #2 ..... word association
Weblogic on Win 98