简单的一键部署SpringBootAPP

最近客户有个新需求,想要一键发布。本着简单(好糊弄)的原则,用bat给弄了一部分,中间坑挺多的,特此记录一下。
首先先上源码
::取得安装目录
set installDir=%cd%
set installDir=%installDir%\
::安装JDK
set JAVA_HOME=%installDir%jdk
set PATH=%PATH%; %%JAVA_HOME%%\bin; %%JAVA_HOME%%\jre\bin
set CLASSPATH=.; %%JAVA_HOME%%\lib\dt.jar; %%JAVA_HOME%%\lib\tools.jar
wmic ENVIRONMENT where "name='path' and username=''" set VariableValue='https://www.it610.com/article/%PATH%'
wmic ENVIRONMENT create name="JAVA_HOME",username="",VariableValue="https://www.it610.com/article/%JAVA_HOME%"
wmic ENVIRONMENT create name="CLASSPATH",username="",VariableValue="https://www.it610.com/article/%CLASSPATH%"

::安装VC
start /wait %installDir%\vcredist_x64.exe /S
if %errorlevel%==0 (echoVC++2013安装成功)
echo mysql-5.7.22-winx64僀儞僗僩乕儖
echo [client] >>%installDir%mysql-5.7.22-winx64\my.ini
echo default-character-set=utf8 >>%installDir%mysql-5.7.22-winx64\my.ini
echo port=3306 >>%installDir%mysql-5.7.22-winx64\my.ini
echo [mysqld] >>%installDir%mysql-5.7.22-winx64\my.ini
echo port=3306 >>%installDir%mysql-5.7.22-winx64\my.ini
echo basedir=%installDir%mysql-5.7.22-winx64>>%installDir%mysql-5.7.22-winx64\my.ini
echo datadir=%installDir%mysql-5.7.22-winx64\data>>%installDir%mysql-5.7.22-winx64\my.ini
echo character-set-server=utf8 >>%installDir%mysql-5.7.22-winx64\my.ini
echo [mysql] >>%installDir%mysql-5.7.22-winx64\my.ini
echo default-character-set=utf8 >>%installDir%mysql-5.7.22-winx64\my.ini
rem edit my.ini end.
cd %installDir%mysql-5.7.22-winx64\bin
mysqld -install
mysqld --initialize-insecure
net start mysql
mysqladmin -u root password "kccs0000"
mysql -f -u root --password=kccs0000 mysql < %installDir%sql\ddl\create_datetbase.sql --default-character-set=utf8
mysql -f -u root --password=kccs0000 md < %installDir%sql\ddl\create.sql --default-character-set=utf8
mysql -f -u root --password=kccs0000 md < %installDir%sql\dml\insert.sql --default-character-set=utf8

【简单的一键部署SpringBootAPP】cd %installDir%jdk/bin
java -jar %installDir%MedicDiet-9.0.0.jar
pause
1.添加环境变量的时候据说wmic这个命令可以立马生效 2.start /wait %installDir%\vcredist_x64.exe /S 这个命令可以静默安装,不必让客户点击下一步?? ??

    推荐阅读