@echo off The role of rem current bat echo ==================begin======================== cls SET NGINX_PATH=D: SET NGINX_DIR=D:\Program Files (x86)\nginx-1.10.1\ color 0a TITLE Nginx Hypervisor Power By Ants (http://leleroyn.cnblogs.com) CLS ECHO. ECHO. * * Nginx hypervisor Power By Ants (http://leleroyn.cnblogs.com) * ECHO. * update by Vv 2017-04-20 * ECHO. :MENU ECHO. * nginx process list * tasklist|findstr /i "nginx.exe" ECHO. ECHO. [1] Start Nginx ECHO. [2] Close Nginx ECHO. [3] Restart Nginx ECHO. [4] Exit ECHO. ECHO. Please enter the serial number of the selected item: set /p ID= IF "%id%"=="1" GOTO start IF "%id%"=="2" GOTO stop IF "%id%"=="3" GOTO restart IF "%id%"=="4" EXIT PAUSE :start call :startNginx GOTO MENU :stop call :shutdownNginx GOTO MENU :restart call :shutdownNginx call :startNginx GOTO MENU :shutdownNginx ECHO. ECHO. Close Nginx...... taskkill /F /IM nginx.exe > nul ECHO.OK, close all nginx processes goto :eof : startNginx ECHO. ECHO. Start Nginx...... IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe"不存在 %NGINX_PATH% cd "%NGINX_DIR%" ECHO. Delete log... cd logs del /F /S /Q *.* cd "%NGINX_DIR%" IF EXIST "%NGINX_DIR%nginx.exe" ( echo "start '' nginx.exe" start "" nginx.exe ) ECHO.OK goto :eof