How do i make a batch file to stop running other/next commands if first or any other command fails.
call grails clean
call grails compile
call grails package
call grails war
If grails clean fail then grails compile should not run and same with others.
grailsa batch file or an executable? Please specify in your batch filegrailswith file extension. The commandcallis needed only for batch files, not for console applications. To exit a batch file on previous command exited not successful useif errorlevel 1 goto :EOForif errorlevel 1 exit /B 1. Run in a command prompt windowif /?andgoto /?for help on those two commands. Run in command prompt window alsoexit /?for help on this command in case ofgrailsis a batch file which needs to exit with an exit code greater 0 on error for parent batch file exit.grailsis a batch file @Mofigrailssets theErrorLevel, anif not ErrorLevel 1(meaningErrorLevel<1) query could be used; ifgrailssets the exit code, use&&operator (execute next command in case of zero exit code);ErrorLeveland exit code are equal most of the time but are actually different things...