@echo off cd /d "%~dp0" .venv\Scripts\python.exe -c " import os, signal, subprocess ports = (8000, 8001, 5173) for port in ports: try: r = subprocess.run(['netstat', '-ano'], capture_output=True, text=True) for line in r.stdout.splitlines(): if f':{port}' in line and 'LISTENING' in line: pid = int(line.split()[-1]) print(f'Killing PID {pid} on port {port}') os.kill(pid, signal.SIGTERM) except Exception as e: print(f'Port {port}: {e}') print('Done') " pause