1、Mysql用服务启动
@echo off
if exist "%CATALINA_HOME%" (goto update_CATALINA_HOME) else (goto create_CATALINA_HOME)
:create_CATALINA_HOME
wmic ENVIRONMENT create name="CATALINA_HOME",username="",VariableValue="%cd%\tomcat"
:update_CATALINA_HOME
wmic ENVIRONMENT set name="CATALINA_HOME",username="",VariableValue="%cd%\tomcat"
if exist "%JAVA_HOME%" (goto update_JAVA_HOME) else (goto create_JAVA_HOME)
:create_JAVA_HOME
wmic ENVIRONMENT create name="JAVA_HOME",username="",VariableValue="%cd%\jdk"
:update_JAVA_HOME
wmic ENVIRONMENT set name="JAVA_HOME",username="",VariableValue="%cd%\jdk"
if exist "%ANT_HOME%" (goto update_ANT_HOME) else (goto create_ANT_HOME)
:create_ANT_HOME
wmic ENVIRONMENT create name="ANT_HOME",username="",VariableValue="%cd%\ant"
:update_ANT_HOME
wmic ENVIRONMENT set name="ANT_HOME",username="",VariableValue="%cd%\ant"
wmic ENVIRONMENT set name="CLASSPATH",username="",VariableValue=".;%%JAVA_HOME%%\lib"
@echo off
set MYSQL_HOME=%~dp0mysql
echo MYSQL_HOME=%MYSQL_HOME%
del /F my.ini
echo [client] >> my.ini
echo port = 3306 >> my.ini
echo default_character_set=utf-8 >> my.ini
echo [mysqld] >> my.ini
echo %server_default_character_set%=utf8 >> my.ini
echo default_storage_engine=InnoDB >> my.ini
echo basedir=%MYSQL_HOME%>>my.ini
echo datadir=%MYSQL_HOME%data>> my.ini
echo innodb_data_file=ibdata1:50M;ibdata2:10M:autoextend >> my.ini
echo transaction-isolation=READ-COMMITTED >> my.ini
echo port=%server_port% >> my.ini
echo max_allowed_packet = 64M >> my.ini
echo "my.ini in %MYSQL_HOME% created."
set PATH=%MYSQL_HOME%\bin;%PATH%
if exist "%MYSQL_HOME%\bin\mysqld-nt.exe" call %MYSQL_HOME%\bin\mysqld-nt --install-manual "mysql" --defaults-file="%MYSQL_HOME%my.ini"
if not exist "%MYSQL_HOME%\bin\mysqld-nt.exe" call %MYSQL_HOME%\bin\mysqld --install-manual "mysql" --defaults-file="%MYSQL_HOME%\my.ini"
net start mysql
@echo off
if exist "%CATALINA_HOME%" go startup
echo Cannot find "CATALINA_HOME%"
:startup
call "%CATALINA_HOME%\bin\startup.bat" start
2、Mysql不用服务启动
parameter.bat set CURRENT_DIR=%cd% set JAVA_HOME=%CURRENT_DIR%\jdk set CATALINA_HOME=%CURRENT_DIR%\tomcat set MYSQL_HOME=%CURRENT_DIR%\mysql set PATH=%PATH%;%JAVA_HOME%\bin;%CATALINA_HOME%\bin;%MYSQL_HOME%\bin startdatabase.bat call parameter.bat cd %MYSQL_HOME%\bin mysqld stopdatabase.bat call parameter.bat cd %MYSQL_HOME%\bin mysqladmin -u root -p shutdown start.bat call parameter.bat call "%CATALINA_HOME%\bin\startup.bat" stop.bat call "%CATALINA_HOME%\bin\shutdown.bat"