Nginx 启停脚本
本脚本编写参考了 https://www.iteye.com/blog/wenluoxicheng-2305679
@REM --关闭执行命令语句回显--
@echo off
@REM --切换到 UTF-8 编码,支持中文显示--
chcp 65001 > nul
@REM --设置命令行标题--
title Nginx 管理程序
color 0a
echo =============================================
echo *** Nginx 管理程序 ***
echo =============================================
:menu
echo * nginx 进程list *
tasklist|findstr /i "nginx.exe"
if ERRORLEVEL 1 (echo 不存在nginx进程) else (echo 有正在运行的nginx进程)
echo:
echo [1] 启动Nginx
echo [2] 关闭Nginx
echo [3] 重启Nginx
echo [4] 退 出
echo:
echo =============================================
set /p ID=请输入选择项目的序号:
if "%id%"=="1" goto :start
if "%id%"=="2" goto :stop
if "%id%"=="3" goto :restart
if "%id%"=="4" goto :end
goto :menu
:start
call :startNginx
goto :menu
:stop
call :shutdownNginx
goto :menu
:restart
call :shutdownNginx
call :startNginx
goto :menu
:startNginx
echo:
echo 启动Nginx......
echo "start '' nginx.exe"
start "" nginx.exe
echo OK
goto :end
:shutdownNginx
echo:
echo 关闭Nginx......
taskkill /F /IM nginx.exe > nul
echo OK
goto :end
:end
set ID=