aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Author

.bat Executed Direct from exec

Chris Bohannon
Greenhorn

Joined: Jul 28, 2009
Posts: 8

Hello,

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?

Thanks!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

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
 
Don't get me started about those stupid light bulbs.
 
subject: .bat Executed Direct from exec
 
Similar Threads
executing a .bat file through ANT
Problem running dos batch file
Setting environment variable in ANT
can't start startup.bat from my application ?
java program to accept user input, ant