In my project, I call java program from the command window. I have a bat file like the following. I throw a RuntimeException in Test class. With “|| exit /b 1”, all the commands after “”%JAVA_HOME%\bin\java” -cp “bin/” Test %RUN_ARGS% || exit /b 1″ will be skipped.
Can anybody tell me what “|| exit /b 1” does? What is the meaning of “||” in the command line?
@echo off
setlocal
set RUN_ARGS=%*
"%JAVA_HOME%\bin\java" -cp "bin/" Test %RUN_ARGS% || exit /b 1
echo %RUN_ARGS%
dir
endlocal
exit /b 0
exit /B exits the batch file without exiting the command window. In other words, it leaves the command window open after your java process exits so you can review any output.
the | is a pipe operator, it passes the output of the java command as input to the exit command.