How can I call a batch file inside a nant script??? (Maybe having a target that calls the batch file).
To run a batch file, move to the directory containing the file and type the name of the batch file. For example, if the batch file is named "hope. bat," you'd type "hope" to execute the batch file.
That's pretty easy, actually - i'll try to illustrate:
<target name="run-command">
<exec program="ConsoleTest.exe" basedir="${test.dir}">
<arg value="-cp" />
</exec>
</target>
The basedir is optional, it specifies where to run the program from. But if your program is on the path (like ping), you probably don't have to worry about it.
Have a look at the official documentation as well :)
Before dropping to a batch file have you considered the tasks in nantcontrib? I needed to smoosh some little javascript files together and was going to use a batch file, but it turns out that nantcontrib has a concat task, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With