summaryrefslogtreecommitdiff
path: root/bin/spack_cmd.bat
diff options
context:
space:
mode:
Diffstat (limited to 'bin/spack_cmd.bat')
-rw-r--r--bin/spack_cmd.bat8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/spack_cmd.bat b/bin/spack_cmd.bat
index 5ba685fa46..56b6024665 100644
--- a/bin/spack_cmd.bat
+++ b/bin/spack_cmd.bat
@@ -15,8 +15,12 @@ popd
:: Check if Python is on the PATH
if not defined python_pf_ver (
-(for /f "delims=" %%F in ('where python.exe') do (set python_pf_ver=%%F) ) 2> NUL
+(for /f "delims=" %%F in ('where python.exe') do (
+ set python_pf_ver=%%F
+ goto :found_python
+ ) ) 2> NUL
)
+:found_python
if not defined python_pf_ver (
:: If not, look for Python from the Spack installer
:get_builtin
@@ -35,7 +39,7 @@ if not defined python_pf_ver (
:: Python is already on the path
set py_exe=!python_pf_ver!
(for /F "tokens=* USEBACKQ" %%F in (
- `!py_exe! --version`) do (set "output=%%F")) 2>NUL
+ `"!py_exe!" --version`) do (set "output=%%F")) 2>NUL
if not "!output:Microsoft Store=!"=="!output!" goto :get_builtin
goto :exitpoint
)