赞
踩
前提:windows上安装jdk
用txt新建一个后缀为bat文件
1.启动jar脚本
- @echo off
- START "app" javaw -jar app-0.0.1-SNAPSHOT.jar
2.停止jar脚本(如:jar包端口9090)
- @echo off
- set port=9090
- 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
3.重启jar脚本(就是上面两个合起来)
- @echo off
- set port=9090
- 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 版权所有,并保留所有权利。