问题
How can I call a batch file inside a nant script??? (Maybe having a target that calls the batch file).
回答1:
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 :)
回答2:
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.
回答3:
Use the exec task.
来源:https://stackoverflow.com/questions/631592/calling-batch-files-inside-nant