Programming Tips - How I can use Apache Ant to run a Windows batch file (script)?

Date: 2016aug19 Product: ant Language: Java, xml OS: Windows Q. How I can use Apache Ant to run a Windows batch file (script)? A. Use exec like this:
<exec dir="c:/path/to/my/batch" executable="cmd.exe"> <arg value="/c"/> <arg value="mybatch.bat"/> </exec>
Replace c:/path/to/my/batch with the actual path. Replace mybatch.bat with the actual name of your script. Main points: - you don't run the .bat directly - you need to specify /c to cmd.exe