赞
踩
前提:windows上安装 jdk
@echo off
START "app" javaw -jar app-0.0.1-SNAPSHOT.jar
以端口8080为例
@echo off
set port=8080
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
echo kill the process %%m who use the port
taskkill /pid %%m -t -f
goto q
)
:q
就是上面两个合起来
@echo off
set port=8080
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
echo kill the process %%m who use the port
taskkill /pid %%m -t -f
goto start
)
:start
START "app" javaw -jar app-0.0.1-SNAPSHOT.jar
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。