# iniciar.ps1 - Script para cargar .env y ejecutar run.py Write-Host "Cargando variables de entorno desde .env..." -ForegroundColor Green # Verificar si existe .env if (-not (Test-Path ".env")) { Write-Host "ERROR: No se encuentra el archivo .env" -ForegroundColor Red Read-Host "Presiona Enter para salir" exit 1 } # Verificar si existe run.py if (-not (Test-Path "run.py")) { Write-Host "ERROR: No se encuentra el archivo run.py" -ForegroundColor Red Read-Host "Presiona Enter para salir" exit 1 } # Cargar variables del .env Get-Content .env | ForEach-Object { if ( -match '^([^=]+)=(.*)$') { $nombre = $matches[1].Trim() $valor = $matches[2].Trim().Trim('"') [Environment]::SetEnvironmentVariable($nombre, $valor, 'Process') Write-Host "Cargado: $nombre = $valor" -ForegroundColor Yellow } } Write-Host " Ejecutando run.py..." -ForegroundColor Green python run.py Write-Host " Presiona Enter para salir..." -ForegroundColor Gray Read-Host