From 71227c208f4615b402b6af43a4234b44d313faec Mon Sep 17 00:00:00 2001 From: CorpNewt Date: Fri, 7 Jun 2019 10:51:29 -0500 Subject: [PATCH] Cleaner py detection --- gibMacOS.bat | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gibMacOS.bat b/gibMacOS.bat index 1ff83d3..aede867 100644 --- a/gibMacOS.bat +++ b/gibMacOS.bat @@ -6,6 +6,7 @@ set "script_name=%~n0.command" set "thisDir=%~dp0" set /a tried=0 set "toask=yes" +set "python=" goto checkscript @@ -24,15 +25,10 @@ goto checkpy :checkpy REM Get python location -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" - ) +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" ) ) @@ -182,8 +178,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