More py detection fixes

This commit is contained in:
CorpNewt 2019-06-07 11:13:49 -05:00 committed by GitHub
parent 01e36a77dd
commit 5d1369ba32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,6 @@ set "script_name=%~n0.command"
set "thisDir=%~dp0" set "thisDir=%~dp0"
set /a tried=0 set /a tried=0
set "toask=yes" set "toask=yes"
set "python="
goto checkscript goto checkscript
@ -25,10 +24,15 @@ goto checkpy
:checkpy :checkpy
REM Get python location REM Get python location
set "dummypath=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\python.exe" set "python="
FOR /F "tokens=* USEBACKQ" %%F IN (`where python`) DO ( FOR /F "tokens=* USEBACKQ" %%F IN (`python -V 2^>^&1`) DO (
if /i not "%%F" == "!dummypath!" ( set "t=%%F"
set "python=%%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"
)
) )
) )
@ -178,8 +182,8 @@ exit /b
REM Python found REM Python found
cls cls
if "%*"=="" ( if "%*"=="" (
"!python!" "!thisDir!!script_name!" python "!thisDir!!script_name!"
) else ( ) else (
"!python!" "!thisDir!!script_name!" %* python "!thisDir!!script_name!" %*
) )
goto :EOF goto :EOF