I marked the lines in the tomcat.bat that are needed to implement the
"restart" command
with "+" ("-" if changed):
:next
if "%1" == "start" goto startServer
if "%1" == "stop" goto stopServer
if "%1" == "run" goto runServer
if "%1" == "env" goto setupEnv
if "%1" == "ant" goto runAnt
if "%1" == "jspc" goto runJspc
+if "%1" == "restart" goto stopServer
echo Usage:
-echo tomcat (start^|run^|env^|stop)
+echo tomcat (start^|run^|env^|stop^|restart)
echo start - start tomcat in a separate window
echo run - start tomcat in the current window
echo env - setup the environment for tomcat
echo stop - stop tomcat
echo ant - run ant with tomcat context
echo jspc - run jsp pre compiler
+echo restart - stop and start
goto cleanup
:startServer
echo Starting tomcat in new window
echo Using classpath: %CLASSPATH%
echo %JAVA_PRG%java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
start %JAVA_PRG%java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:runServer
rem Start the Tomcat Server
echo Using classpath: %CLASSPATH%
%JAVA_PRG%java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:stopServer
rem Stop the Tomcat Server
echo Using classpath: %CLASSPATH%
%JAVA_PRG%java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat -stop %2 %3 %4 %5 %6 %7 %8 %9
+if "%1" == "restart" goto startServer
goto cleanup