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

echo Stopping WLED Screen Controller...
echo.

REM Find and kill Python processes running wled_controller.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:"wled_controller.main" >nul
    if not errorlevel 1 (
        taskkill /PID %%i /F
        echo WLED controller process (PID %%i) terminated.
    )
)

echo.
echo Done! WLED Screen Controller stopped.
pause
