alert if standalone bat runs with active service

This commit is contained in:
Flowseal 2025-01-12 08:48:46 +03:00
parent 5acf410906
commit 83938b448e
10 changed files with 42 additions and 0 deletions

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -4,6 +4,7 @@ chcp 65001 >nul
:: NOT RECOMMENDED
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

View File

@ -3,6 +3,7 @@ chcp 65001 >nul
:: 65001 - UTF-8
cd /d "%~dp0"
call service_status.bat zapret
call check_updates.bat soft
echo:

33
service_status.bat Normal file
View File

@ -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