python installation trought winget if needed
This commit is contained in:
parent
6b2cd8772f
commit
4a39892c88
1 changed files with 35 additions and 3 deletions
38
header.bat
38
header.bat
|
@ -3,10 +3,42 @@ SETLOCAL ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
SET "tmpFile=%TEMP%\~na.py"
|
SET "tmpFile=%TEMP%\~na.py"
|
||||||
|
|
||||||
CALL :getLine "::python_beg" "::python_end" > "!tmpFile!"
|
:: Variables
|
||||||
|
SET "pipR=pip install pyautogui"
|
||||||
|
SET "py=python.exe"
|
||||||
|
|
||||||
:: Install dependencies
|
:: Check python installation
|
||||||
python -m pip install pyautogui >NUL
|
!py! --version >NUL
|
||||||
|
|
||||||
|
:: Clean potential error or python version
|
||||||
|
CLS
|
||||||
|
|
||||||
|
IF ERRORLEVEL 1 (
|
||||||
|
ECHO Installation of Python not found, installation...
|
||||||
|
|
||||||
|
:: Accept Winget ToT
|
||||||
|
ECHO Y | winget list >NUL
|
||||||
|
|
||||||
|
:: Install Python 3.13 from MS Store
|
||||||
|
ECHO Y | winget install -he 9PNRBTZXMB4Z
|
||||||
|
|
||||||
|
ECHO Download and installation of dependencies...
|
||||||
|
|
||||||
|
:: Location of Python
|
||||||
|
SET "py=%LOCALAPPDATA%\Microsoft\WindowsApps\!py!"
|
||||||
|
|
||||||
|
:: Update pip
|
||||||
|
!py! -m pip install --upgrade pip
|
||||||
|
|
||||||
|
:: Install dependencies
|
||||||
|
!py! -m !pipR!
|
||||||
|
) ELSE (
|
||||||
|
:: Check dependencies
|
||||||
|
!py! -m !pipR! >NUL
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Write the program
|
||||||
|
CALL :getLine "::python_beg" "::python_end" > "!tmpFile!"
|
||||||
|
|
||||||
:: Run the program
|
:: Run the program
|
||||||
PowerShell -Command "Start-Process cmd -Argument '/c START /B python !tmpFile!' -WindowStyle hidden"
|
PowerShell -Command "Start-Process cmd -Argument '/c START /B python !tmpFile!' -WindowStyle hidden"
|
||||||
|
|
Loading…
Reference in a new issue