@echo off title AidsMonitoring Server cd /d "%~dp0backend" :: Matar proceso previo en el puerto 5503 for /f "tokens=5" %%a in ('netstat -ano 2^>nul ^| findstr ":5503 " ^| findstr "LISTENING"') do ( taskkill /F /PID %%a >nul 2>&1 ) timeout /t 1 /nobreak >nul echo. echo ================================================ echo AidsMonitoring ^| http://localhost:5503 echo ================================================ echo. :: Abrir navegador tras 3 segundos start "" /b cmd /c "timeout /t 3 /nobreak >nul && start http://localhost:5503" :: Usar venv si existe, si no buscar python en el PATH if exist "%~dp0venv\Scripts\python.exe" ( set "PY=%~dp0venv\Scripts\python.exe" ) else ( set "PY=python" ) :loop "%PY%" -m uvicorn main:app --host 0.0.0.0 --port 5503 echo. echo Servidor detenido. Reiniciando en 3 segundos... (Ctrl+C para salir) timeout /t 3 /nobreak >nul goto loop