最近用到了,现做简单总结:

启动
1
2
3
4
@echo off
%1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit
java -jar -Dfile.encoding=utf-8 eladmin-system-2.6.jar >StartupLog.log 2>&1 &
exit
停止
1
2
3
4
5
6
7
8
@echo off
set port=8000
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
重启
1
2
3
4
5
6
7
8
9
10
11
12
@echo off
set port=8000
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

%1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit
java -jar -Dfile.encoding=utf-8 eladmin-system-2.6.jar >StartupLog.log 2>&1 &
exit