File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes How to run a batch file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to run a batch file " Watch "How to run a batch file " New topic

How to run a batch file

Pradeep Kumar
Ranch Hand

Joined: Sep 11, 2007
Posts: 77
Hi all,
Can someone help me out with the ant command to run a batch file or an exe command.

Thanks and Regards,
Pradeep Kumar

SCJP 1.6
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112

Note that on older windows system, or non-standard installations, the command might be different from "cmd". Which command shell is used by the windows system by default is recorded in the ComSpec environment variable, so you might want to use that instead of the hardcoded "cmd".

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Chetan Sachdev

Joined: May 13, 2008
Posts: 1

That solution worked for me.
I agree. Here's the link:
subject: How to run a batch file
It's not a secret anymore!