@echo off setlocal for /f "tokens=5" %%p in ('netstat -ano ^| findstr ":8081" ^| findstr "LISTENING"') do ( taskkill /PID %%p /F >nul 2>&1 ) taskkill /IM ammc-amb.exe /F >nul 2>&1 echo [OK] Stopped backend on :8081 and ammc-amb.exe (if running) endlocal