This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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:

I agree. Here's the link:
subject: Executing a *.bat file
It's not a secret anymore!