@echo off set ROOT=C:\Users\38524\bin\nginx-1.25.0 echo you nginx root path is : %ROOT% set CMD=%ROOT%\nginx.exe echo you nginx cmd path is : %CMD% set CONF=%ROOT%\conf\nginx.conf echo you nginx conf path is : %CONF% ^ @REM for start @REM echo do command %1 @REM if %1 == 'start' @REM echo will do start @REM if %1 == 'stop' @REM echo will do stop IF "%1" == "start" ( echo do nginx start cd %ROOT% %ROOT%\nginx.exe -c %ROOT%\conf\nginx.conf echo do nginx stopped ) ELSE IF "%1" == "quit" ( echo quitting nginx cd %ROOT% %ROOT%\nginx.exe -s quit echo nginx quitted ) ELSE IF "%1" == "stop" ( echo stopping nginx cd %ROOT% %ROOT%\nginx.exe -s stop echo do nginx stopped ) ELSE IF "%1" == "test" ( cd %ROOT% %ROOT%\nginx.exe -t -c %ROOT%\conf\nginx.conf ) ELSE IF "%1" == "reload" ( cd %ROOT% %ROOT%\nginx.exe -s reload ) ELSE IF "%1" == "v" ( cd %ROOT% %ROOT%\nginx.exe -v ) ELSE ( echo error command, exit ) @REM cd %ROOT% @REM %CMD% -s stop
标签:bat,conf,windows,cmd,echo,nginx,ROOT%,REM,cd From: https://www.cnblogs.com/zcy_soft/p/17438508.html