I looked and located some ques as ** how you can restart apache using nant script ** and attempted similar code but got a bit of message..i attempted this code

<exec executable="${APACHE_HOME}/bin/httpd.exe">
    <arg value="-k"/>
    <arg value="restart"/>
</exec>

OUTPUT:

apache-restart:
     [exec] [Tue Nov 15 19:58:18 2011] [error] (OS 2)The system cannot find the file specified.  : No installed ser
vice named "Apache2.2".
     [exec] Result: 2

And the reason behind this really is i suppose Apache isn't installed like a home windows service.

I attempted both but have problems:

1) my cursor stored blinking and then statement echo wasn't arrived at.

  <target name="test"  depends="init"> 
    <exec executable="${APACHE_HOME}/bin/httpd.exe">
    </exec>
    <echo message="hello "/>
 </target>

OUTPUT:

test:

2)where's this taskkill file present ??

<target name="test"  depends="init"> 
                <exec executable="taskkill /im httpd.exe">
                </exec>
                 <echo message="hello "/>
 </target>

OUTPUT:

 Execute failed: java.io.IOException: Cannot run progra
"taskkill \im httpd.exe": CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)  

Well, install the service first with httpd.exe -k install

Or execute taskkill /im httpd.exe to kill apache and httpd.exe to begin it again. You might want to add /f change to taskkill also.