@echo off
start jre/bin/java-jar jre/lib/master.jar
echo start new master success...
pause
@echo off
start jre/bin/javaw-jar jre/lib/master.jar
echo start new master success...
pause
@echo off
set program=suppet
echo program: %program%
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %program%`) do (
set pid=%%a
set image_name=%%b
)
if not defined pid (echo process %program% does not exists) else (
echo prepare to kill %image_name%
echo start kill %pid% ...
rem 根据进程ID,kill进程
taskkill /f /pid %pid%
)
pause
tasklist命令可以看到所有进程;
tasklist | findstr "java"
可以查看指定字符串的进程
netstat -ano | findstr 88
可以查看指定端口的进程
@echo off
taskkill /f /im java.exe
echo shutdown master success...
pause