diff --git a/discord.bat b/discord.bat index 3fce336..0473570 100644 --- a/discord.bat +++ b/discord.bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (ALT).bat b/general (ALT).bat index fc1ab69..4cb006a 100644 --- a/general (ALT).bat +++ b/general (ALT).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (ALT2).bat b/general (ALT2).bat index ac9cf8f..c2d5147 100644 --- a/general (ALT2).bat +++ b/general (ALT2).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (ALT3).bat b/general (ALT3).bat index 73dc41f..5a47424 100644 --- a/general (ALT3).bat +++ b/general (ALT3).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (ALT4).bat b/general (ALT4).bat index 1806e25..18caf66 100644 --- a/general (ALT4).bat +++ b/general (ALT4).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (ALT5).bat b/general (ALT5).bat index 0997c26..f034108 100644 --- a/general (ALT5).bat +++ b/general (ALT5).bat @@ -4,6 +4,7 @@ chcp 65001 >nul :: NOT RECOMMENDED cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (МГТС).bat b/general (МГТС).bat index 8f8c959..01f644d 100644 --- a/general (МГТС).bat +++ b/general (МГТС).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general (МГТС2).bat b/general (МГТС2).bat index 7752a8f..85549f5 100644 --- a/general (МГТС2).bat +++ b/general (МГТС2).bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/general.bat b/general.bat index 6c0f04f..e749b5e 100644 --- a/general.bat +++ b/general.bat @@ -3,6 +3,7 @@ chcp 65001 >nul :: 65001 - UTF-8 cd /d "%~dp0" +call service_status.bat zapret call check_updates.bat soft echo: diff --git a/service_status.bat b/service_status.bat new file mode 100644 index 0000000..b260adc --- /dev/null +++ b/service_status.bat @@ -0,0 +1,33 @@ +@echo off +chcp 65001 >nul + +if "%~1"=="" ( + call :test_service zapret + call :test_service WinDivert + pause +) else ( + call :test_service "%~1" "soft" +) + +exit /b + +:test_service +set "ServiceName=%~1" +set "ServiceStatus=" + +for /f "tokens=3 delims=: " %%A in ('sc query "%ServiceName%" ^| findstr /i "STATE"') do set "ServiceStatus=%%A" + +set "ServiceStatus=%ServiceStatus: =%" + +if "%ServiceStatus%"=="RUNNING" ( + if "%~2"=="soft" ( + echo "%ServiceName%" is ALREADY RUNNING as service! Use "serivce_remove.bat" first if you want to run standalone bat. + pause + ) else ( + echo "%ServiceName%" service is RUNNING. + ) +) else if not "%~2"=="soft" ( + echo "%ServiceName%" is NOT running. +) + +exit /b