However, the Windows Batch script used to return an errorlevel of 4 when an error occured during the execution of the Java application called within the script. How can I make Unix return the proper errorlevel? Sign up to join this community.
The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 5 years, 4 months ago. Active 5 years, 4 months ago.
Is this page helpful? Please rate your experience Yes No. Any additional feedback? Submit and view feedback for This product This page. View all page feedback. In this article. Specifies a true condition only if the previous program run by Cmd. Turning on DelayedExpansion will force the shell to read variables at the start of every line. When piping commands, the expression is evaluated from left to right, so. You can use brackets and conditionals around the command with this syntax:. Placing an IF command on the right hand side of a pipe is also possible but the CMD shell is buggy in this area and can swallow one of the delimiter characters causing unexpected results.
By default, the command processor will continue executing when an error is raised. You have to code for halting on error. We also pass a specific non-zero return code from the failed command to inform the caller of our script about the failure. Jumping to EOF in this way will exit your current script with the return code of 1. I recommend sticking to zero for success and return codes that are positive values for DOS batch files.
0コメント