Eduard Pal wrote: > > It seems that in tomcat 5.0 when i run startup.bat it exists with code > 1. Does anyone know why? >
It's because of a combination of Windows quirks (or some might say flaws). Whenever one unsets an environment variable (e.g. "set FOO="), the set command sets the errorlevel (i.e. exit code) to 1. In Windows, commands do not always set the errorlevel after exiting. When they do not, the errorlevel keeps its previous value, which is whatever value it was set to by the last command that did actually set it. For example "echo hello" or "set FOO=queue" will not set the errorlevel at all. In catalina.bat, the following line causes the errorlevel to get set to 1: set JPDA= None of the commands following that line set the errorlevel (at least not in the case when the batch file was passed "start" as its first arg), so when the batch file exits, the errorlevel is still set to 1. If catalina.bat was called via startup.bat, startup.bat exits after catalina.bat exits and the errorlevel is still set to 1. A fix for this would be for catalina.bat to execute a command that is known to set the errorlevel back to 0 after the "set JPDA=" line. For example: set JPDA= rem The above command sets the errorlevel to 1. The ver command will reset the errorlevel to 0. ver >nul -Ian -- View this message in context: http://www.nabble.com/startup.bat-exit-code-tp4124264p25258503.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org