Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calling batch files inside nant

How can I call a batch file inside a nant script??? (Maybe having a target that calls the batch file).

like image 422
user62958 Avatar asked Mar 10 '09 18:03

user62958


People also ask

How do you call a 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.


2 Answers

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 :)

like image 68
Haugholt Avatar answered Sep 29 '22 21:09

Haugholt


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.

like image 22
robaker Avatar answered Sep 29 '22 22:09

robaker