Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ant Wiki" for change 
notification.

The following page has been changed by DavidOram:
http://wiki.apache.org/ant/AntOnWindows

The comment on the change is:
Formatted the code as such

------------------------------------------------------------------------------
  = Executing batch files =
  When executing batch files on windows through the <exec> task you commonly 
execute the cmd.exe program to run the batch file.  However this means that any 
ERRORLEVEL reported by the batch file is not propagated up to ant.  If you want 
to run a batch file, and fail if the batchfile sets the ERRORLEVEL, then you 
can try this recipe:
  
+ {{{
        <!--
        When running a batch files from ant, it cannot detect the %ERRORLEVEL% 
as set by 'exit /B 1'
        This macro is inspired from 
http://marc.info/?l=ant-user&m=117748848509224&q=raw 
@@ -48, +49 @@

                    </fail>
                </sequential>
        </macrodef>
- 
+ }}}
  
  And to execute a batch file:
- <runBat batch="mycommand.bat" args="foo bar moo"/>
+ {{{<runBat batch="mycommand.bat" args="foo bar moo"/>}}}
  
  This will fail the ant script if mycommand.bat fails, ie: if the batchfile 
executes "exit /b 1"
  

Reply via email to