基于svn的springboot后台批量打包+按时间建文件夹+按时间命名+挪动jar包位置
@echo off
set bh=E:\workplace\source\package\package_directory_java_bh\
set jar_path=E:\workplace\source\package\package_bat\jar\
set YMD=%date:~,10%
set YMD=%YMD:/=-%
set HMS=%time:~,8%
set HMS=%HMS: =0%
set HMS=%HMS::=.%
set directory="bh_java_directory_%YMD%-%HMS%"
echo "-------------------svn up to date-------------------"
cd /d %bh%
call svn up
echo "svn success"
echo "-------------------guarbasicinfo install -------------------"
cd /d "%bh%\base.biz.svc.guarbasicinfo"
call mvn clean install
echo "guarbasicinfo success!"
echo "-------------------guarlettermgr install -------------------"
cd /d "%bh%\base.biz.svc.guarlettermgr"
call mvn clean install
echo "guarlettermgr success!"
echo "-------------------guarprocessmgr install -------------------"
cd /d "%bh%\base.biz.svc.guarprocessmgr"
call mvn clean install
echo "guarprocessmgr success!"
echo "-------------------createDirectory start-------------------"
call md %jar_path%%directory%
echo "createDirectory finished"
echo "-------------------guarbasicinfo.jar copy start-------------------"
call copy /y "%bh%\base.biz.svc.guarbasicinfo\target\base.biz.svc.guarbasicinfo-0.0.1-release.jar" %jar_path%%directory%"\base.biz.svc.guarbasicinfo-%YMD% %HMS%.jar"
echo "guarbasicinfo.jar copy finished"
echo "-------------------guarlettermgr.jar copy start"-------------------"
call copy /y "%bh%\base.biz.svc.guarlettermgr\target\base.biz.svc.guarlettermgr-0.0.1-release.jar" "%jar_path%%directory%\base.biz.svc.guarlettermgr-%YMD% %HMS%.jar"
echo "guarlettermgr.jar copy finished"
echo "-------------------guarprocessmgr.jar copy start"-------------------"
call copy /y "%bh%\base.biz.svc.guarprocessmgr\target\base.biz.svc.guarprocessmgr-0.0.1-release.jar" "%jar_path%%directory%\base.biz.svc.guarprocessmgr-%YMD% %HMS%.jar"
echo "guarprocessmgr.jar copy finished"
pause
echo "success"
基于git的vue前端批量打包+挪动build文件夹位置+按时间命名并压缩成zip包
@echo off
set YMD=%date:~,10%
set YMD=%YMD:/=-%
set HMS=%time:~,8%
set HMS=%HMS: =0%
set HMS=%HMS::=.%
set bh=E:\workplace\source\package\package_directory_web_bh\guaranteeLetter-web\
set package_path=E:\workplace\source\package\package_bat\web\
set zipPath="C:\Program Files\WinRAR\WinRAR.exe"
echo "-------------------git up to date-------------------"
cd /d %bh%
call git checkout develop_20200623
call git pull
echo "git success"
echo "-------------------npm install-------------------"
call npm install
echo "npm install success!"
echo "-------------------npm run build-------------------"
call npm run build:prod
echo "npm run build success!"
echo "-------------------web copy start"-------------------"
call xcopy /s /y "%bh%dist\*.*" "%package_path%"
echo "web copy finished"
echo "-------------------zip start"-------------------"
cd %package_path%
%zipPath% -x"*.zip" a -r "dist-%YMD% %HMS%-bh-web.zip" -df
echo "zip finished"
pause
echo "success"
由于后端搬到git管理了,每个子module是单独的仓库地址,修改打包相关的批处理bat
@echo off
set bh=E:\workplace\source\package\package_directory_java_bh_svn\
set jar_path=E:\workplace\source\package\package_bat\jar\
set YMD=%date:~,10%
set YMD=%YMD:/=-%
set HMS=%time:~,8%
set HMS=%HMS: =0%
set HMS=%HMS::=.%
set directory="git_bh_java_directory_%YMD%-%HMS%"
echo "---------------git up dating---------------"
set bh="E:\workplace\source\package\package_directory_java_bh_git\"
echo ">>>>>>>>>guarbasicinfo updating<<<<<<<<<"
cd /d %bh%\base.biz.svc.guarbasicinfo
call git checkout develop_20200826
call git pull -f
echo "guarbasicinfo up to update"
echo ">>>>>>>>>guarlettermgr updating<<<<<<<<<"
cd /d %bh%\base.biz.svc.guarlettermgr
call git checkout develop_20200826
call git pull -f
echo "guarlettermgr up to update"
echo ">>>>>>>>>guarprocessmgr updating<<<<<<<<<"
cd /d %bh%\base.biz.svc.guarprocessmgr
call git checkout develop_20200826
call git pull -f
echo "guarprocessmgr up to update"
echo "git up to date success"
echo "-------------------guarbasicinfo install -------------------"
cd /d "%bh%\base.biz.svc.guarbasicinfo"
call mvn clean install
echo "guarbasicinfo success!"
echo "-------------------guarlettermgr install -------------------"
cd /d "%bh%\base.biz.svc.guarlettermgr"
call mvn clean install
echo "guarlettermgr success!"
echo "-------------------guarprocessmgr install -------------------"
cd /d "%bh%\base.biz.svc.guarprocessmgr"
call mvn clean install
echo "guarprocessmgr success!"
echo "-------------------createDirectory start-------------------"
call md %jar_path%%directory%
echo "createDirectory finished"
echo "-------------------guarbasicinfo.jar copy start-------------------"
call copy /y "%bh%\base.biz.svc.guarbasicinfo\target\base.biz.svc.guarbasicinfo-0.0.1-release.jar" %jar_path%%directory%"\base.biz.svc.guarbasicinfo-%YMD% %HMS%.jar"
echo "guarbasicinfo.jar copy finished"
echo "-------------------guarlettermgr.jar copy start"-------------------"
call copy /y "%bh%\base.biz.svc.guarlettermgr\target\base.biz.svc.guarlettermgr-0.0.30.8-release.jar" "%jar_path%%directory%\base.biz.svc.guarlettermgr-%YMD% %HMS%.jar"
echo "guarlettermgr.jar copy finished"
echo "-------------------guarprocessmgr.jar copy start"-------------------"
call copy /y "%bh%\base.biz.svc.guarprocessmgr\target\base.biz.svc.guarprocessmgr-0.0.1-release.jar" "%jar_path%%directory%\base.biz.svc.guarprocessmgr-%YMD% %HMS%.jar"
echo "guarprocessmgr.jar copy finished"
pause
echo "success"
bat杀指定端口进程
@echo off
setlocal enabledelayedexpansion
set /p port=pls input port need to kill=
for /f "tokens=1-5" %%a in ('netstat -ano ^| find ":%port%"') do (
if "%%e%" == "0" (
set pid=%%d
echo no task has used port 【%port%】
) else (
set pid=%%e
echo find %port% in pid =!pid!
taskkill /f /pid !pid!
pause
)
)