rem 关闭命令输出 @echo off rem 启动jar名称 set projectName=demo.jar rem 部署目录 set projectDir=D:\develop\script\bat-update rem 备份路径 set backupDir=D:\develop\script\bat-update\backup
@set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" rem 年月日 分秒毫秒 没有小时,0-9点,前部默认不补零 @set "nowtime=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%%TIME:~3,2%%TIME:~6,2%"
echo ' shutdown start ' for /F %%i in ('jps -mvVl ^| findstr %projectName%')do ( set commitid=%%i) if "%commitid%"=="" (echo ' 程序没有启动') else ( taskkill /F /PID %commitid% IF ERRORLEVEL 0 (echo ' shutdown success ') IF ERRORLEVEL 1 (echo ' shutdown fail ' pause ) )