Add run.bat (background with pythonw), stop.bat, run.vbs

This commit is contained in:
Lizandro Guarnizo
2026-06-17 18:26:42 -05:00
parent 25ca4a504c
commit 6a064c2ed5
3 changed files with 24 additions and 36 deletions
+18 -36
View File
@@ -1,48 +1,30 @@
@echo off @echo off
chcp 65001 >nul chcp 65001 >nul
title RIPS Manager - Iniciando...
:: Verificar si ya existe Python portable :: Verificar Python
if exist python\python.exe goto :start where python >nul 2>&1
if %errorlevel% neq 0 (
echo ========================================== echo Descargando Python...
echo Descargando Python portable... powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-amd64.exe' -OutFile '%TEMP%\python-installer.exe'}"
echo ========================================== start /wait "" "%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
echo. echo Python instalado. Ejecuta de nuevo el .bat
:: Descargar Python embeddable (64-bit)
powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip' -OutFile 'python.zip'}"
if not exist python.zip (
echo ERROR: No se pudo descargar Python
pause pause
exit /b exit /b
) )
echo. :: Instalar dependencias
echo Extrayendo... python -m pip install -q -r requirements.txt
powershell -Command "& {Expand-Archive -Path 'python.zip' -DestinationPath 'python' -Force}"
del python.zip
:: Habilitar pip (descomentar línea en el archivo de configuración) :: Matar instancia anterior si existe
set PYTHON_EXE=%~dp0python\python.exe taskkill /f /im python.exe 2>nul
set PTH_FILE=%~dp0python\python312._pth taskkill /f /im pythonw.exe 2>nul
powershell -Command "& {(Get-Content '%PTH_FILE%') -replace '#import site','import site' | Set-Content '%PTH_FILE%'}"
:: Instalar pip :: Iniciar sin ventana
echo. start /b pythonw main.py
echo Instalando pip...
%PYTHON_EXE% -c "import urllib.request; exec(urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py').read())"
:start
echo.
echo Instalando dependencias...
python\python.exe -m pip install -q -r requirements.txt 2>nul
echo.
echo ========================================== echo ==========================================
echo Servidor iniciado en http://localhost:8080 echo RIPS Manager iniciado en segundo plano
echo Presiona Ctrl+C para detener echo http://localhost:8080
echo ========================================== echo ==========================================
python\python.exe main.py timeout /t 5 /nobreak >nul
pause exit
+2
View File
@@ -0,0 +1,2 @@
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "powershell -ExecutionPolicy Bypass -NoProfile -Command ""Start-Process python -ArgumentList 'main.py' -WindowStyle Hidden""", 0, False
+4
View File
@@ -0,0 +1,4 @@
@echo off
taskkill /f /im pythonw.exe 2>nul
echo Servidor detenido.
timeout /t 2 /nobreak >nul