aspose file tools
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 Elasticsearch in Action this week in the Big Data 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:

It is sorta covered in the JavaRanch Style Guide.
subject: Executing a *.bat file