@echo off
REM LedGrab Stop Script
REM This script stops the running WLED screen controller server

echo Stopping LedGrab...
echo.

REM Find and kill Python processes running ledgrab.main
for /f "tokens=2" %%i in ('tasklist /FI "IMAGENAME eq python.exe" /FO LIST ^| findstr /B "PID:"') do (
    wmic process where "ProcessId=%%i" get CommandLine 2>nul | findstr /C:"ledgrab.main" >nul
    if not errorlevel 1 (
        taskkill /PID %%i /F
        echo WLED controller process (PID %%i) terminated.
    )
)

echo.
echo Done! LedGrab stopped.
pause
