Whether if "% OS%" == "Windows_NT" setlocal // determine whether the current system is the window system
rem ------------------------------------------------- -------------------------- // rem is a comment (below)
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 302918 2004-05-27 18:25:11Z yoavs $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
set CURRENT_DIR =% cd% // set the current directory
if not "% CATALINA_HOME%" == "" gotogotHome // If you set the CATALINA_HOME environment variable, directly at the following gotHome
set CATALINA_HOME =% CURRENT_DIR% // If you do not set the CATALINA_HOME, CATALINA_HOME is set to the current directory (in fact, here she assumes you enter the installation directory of tomcat)
if exist "% CATALINA_HOME% \ bin \ catalina.bat" gotookHome // determine what catalina.bat if found, we found directly at the following gotHome
cd .. // Here he is assuming you have entered to start the tomcat bin directory, so we retreated to the parent directory
set CATALINA_HOME =% cd% // now again set to the installation directory of tomcat CATALINA_HOME
cd% CURRENT_DIR% // here is to enter dos current directory
:gotHome
if exist "% CATALINA_HOME% \ bin \ catalina.bat" gotookHome // determine again whether catalina.bat found, found directly at the following okHome, not, you can only prompt you anyway!
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
set EXECUTABLE =% CATALINA_HOME% \ bin \ catalina.bat // set the file to be executed
rem Check that target executable exists
if exist "% EXECUTABLE%" gotookExec // determine again whether catalina.bat found, we found directly at the following okExec, not, on the tips.
echo Cannot find %EXECUTABLE%
echo This file is needed to run this program
goto end
:okExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS = // here is to set the parameters
:setArgs
if ""% 1 "" == "" "" gotodoneSetArgs // parameter determines whether the addition was complete
set CMD_LINE_ARGS =% CMD_LINE_ARGS%% 1 // parameters form a row, then later
shift
gotosetArgs
: doneSetArgs
call "% EXECUTABLE%" start% CMD_LINE_ARGS% // execute catalina.bat, the best that this be changed: echo "% EXECUTABLE%" start% CMD_LINE_ARGS% in order to read and understand the role of this document
:end
// this batch file, primarily the right to find catalina.bat, and execution.
When the tomcat extract to a place, usually set the environment variable CATALINA_HOME of the implementation of this document, it is easy to find catalina.bat
If you do not set the CATALINA_HOME environment variable, then you need to enter the installation directory tomcat in the dos, bin ... or subdirectory, and then execute the file, if in a different directory, suggesting that no files will appear.
Modify startup.bat, it does not rely JAVA_HOM and CATALINA_HOME variables Method:
SET JAVA_HOME = JDK directory
SET CATALINA_HOME = after decompression Tomcat directory
E.g:
set JAVA_HOME=D:\Program Files\java\jdk1.6.0_21
set CATALINA_HOME=D:\Program Files\apache-tomcat-6.0.29
Reference: https: //www.cnblogs.com/zhenmingliu/archive/2011/11/29/2268332.html