From 4e19bf4197c1e6aaf82d4a6de31dcc57c5cb1aa5 Mon Sep 17 00:00:00 2001 From: CorpNewt Date: Thu, 14 Mar 2019 13:09:20 -0500 Subject: [PATCH] Prompt to install python --- MakeInstall.bat | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/MakeInstall.bat b/MakeInstall.bat index db3fabb..894aff4 100644 --- a/MakeInstall.bat +++ b/MakeInstall.bat @@ -31,6 +31,7 @@ REM Setup initial vars set "script_name=%~n0.py" set "thisDir=%~dp0" set /a tried=0 +set "toask=yes" goto checkscript @@ -56,7 +57,12 @@ FOR /F "tokens=* USEBACKQ" %%F IN (`where python 2^> nul`) DO ( REM Check for py and give helpful hints! if /i "!python!"=="" ( if %tried% lss 1 ( - goto installpy + if /i "!toask!"=="yes" ( + REM Better ask permission first + goto askinstall + ) else ( + goto installpy + ) ) else ( cls echo ### ### @@ -79,6 +85,26 @@ if /i "!python!"=="" ( ) goto runscript +:askinstall +cls +echo ### ### +echo # Python Not Found # +echo ### ### +echo. +echo Python was not found on the system or in the PATH var. +echo. +set /p "menu=Would you like to install it now? [y/n]: " +if /i "!menu!"=="y" ( + REM We got the OK - install it + goto installpy +) else if "!menu!"=="n" ( + REM No OK here... + set /a tried=%tried%+1 + goto checkpy +) +REM Incorrect answer - go back +goto askinstall + :installpy REM This will attempt to download and install python REM First we get the html for the python downloads page for Windows