From 6e2df5488671ff3345a88160dcfe3fc4f20c39dc Mon Sep 17 00:00:00 2001 From: CorpNewt Date: Fri, 7 Jun 2019 11:14:30 -0500 Subject: [PATCH] More py detection fixes --- MakeInstall.bat | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/MakeInstall.bat b/MakeInstall.bat index 9ff164c..7e080e4 100644 --- a/MakeInstall.bat +++ b/MakeInstall.bat @@ -32,7 +32,6 @@ set "script_name=%~n0.py" set "thisDir=%~dp0" set /a tried=0 set "toask=yes" -set "python=" goto checkscript @@ -51,10 +50,15 @@ goto checkpy :checkpy REM Get python location -set "dummypath=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\python.exe" -FOR /F "tokens=* USEBACKQ" %%F IN (`where python`) DO ( - if /i not "%%F" == "!dummypath!" ( - set "python=%%F" +set "python=" +FOR /F "tokens=* USEBACKQ" %%F IN (`python -V 2^>^&1`) DO ( + set "t=%%F" + if /i "!t:~0,6!" == "python" ( + REM Might have python installed - let's check for the store message + if /i "!t:was not found=!" == "!t!" ( + REM There was no change - we found it. + set "python=%%F" + ) ) ) @@ -204,8 +208,8 @@ exit /b REM Python found cls if "%*"=="" ( - "!python!" "!thisDir!!script_name!" + python "!thisDir!!script_name!" ) else ( - "!python!" "!thisDir!!script_name!" %* + python "!thisDir!!script_name!" %* ) goto :EOF