通过bat启动与关停服务
1. startup.bat
@echo off REM change current directory D: cd D:\xxxxxx\nginx-1.24.0 REM set envi variable SET "PATH=%PATH%;D:\xxxxxx\nginx-1.24.0\contrib" REM start nginx start nginx echo start nginx process at 127.0.0.1:9090 pause
2. shutdown.bat
@echo off set program=nginx.exe echo program: %program% taskkill /IM %program% /F REM for /f "tokens=5" %%a in ('netstat -ano ^| findstr "9090"') do taskkill /pid %%a -t -f REM 普通级别强杀“lsass.exe”进程。 REM for /f "tokens=2,3*" %i in ('tasklist /nh ^| find "lsass.exe"') do ntsd -c q -p %i REM 驱动级强行杀死所有名为“stormliv.exe”的进程(可以干掉网维等产品)。 REM for /f "tokens=1,2" %%i in ('tasklist') do (echo %%i | findstr /i "stormliv.exe" 1>nul 2>nul && (ntsd -c q -p %%j & set qq=%%i)) echo The process %program% has been terminated. paus