bat设置环境变量 启动mysql非安装版服务 启动tomcat
@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="<system>",VariableValue="%cd%\tomcat"
:update_CATALINA_HOME
wmic ENVIRONMENT set name="CATALINA_HOME",username="<system>",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="<system>",VariableValue="%cd%\jdk"
:update_JAVA_HOME
wmic ENVIRONMENT set name="JAVA_HOME",username="<system>",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="<system>",VariableValue="%cd%\ant"
:update_ANT_HOME
wmic ENVIRONMENT set name="ANT_HOME",username="<system>",VariableValue="%cd%\ant"
wmic ENVIRONMENT set name="CLASSPATH",username="<system>",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