wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes .bat Executed Direct from exec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark ".bat Executed Direct from exec" Watch ".bat Executed Direct from exec" New topic

.bat Executed Direct from exec

Chris Bohannon

Joined: Jul 28, 2009
Posts: 8


I have an Ant related question. According to the Ant manual:

Note that .bat files cannot in general by executed directly. One normally needs to execute the command shell executable cmd using the /c switch.

Here is a code snippet:

This seems to work just fine. I am executing a .bat file directly from the exec task. Now the manual states "general" usage, but I am wondering if I should use the recommend method or is it safe to do what I am doing?

Peter Johnson

Joined: May 14, 2008
Posts: 5812

That might be really old text because if I recall correctly that was a problem many years ago. If it is working for you, go for it.

JBoss In Action
I agree. Here's the link: http://aspose.com/file-tools
subject: .bat Executed Direct from exec
Similar Threads
Setting environment variable in ANT
Problem running dos batch file
executing a .bat file through ANT
can't start startup.bat from my application ?
java program to accept user input, ant