+ ) else (\r
+ goto check_freezer_path\r
+ )\r
+)\r
+\r
+:check_python2\r
+endlocal\r
+if defined PYTHON_HOME (\r
+ if EXIST "%PYTHON_HOME%" (\r
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+ goto check_python_available\r
+ )\r
+)\r
+if defined PYTHONHOME (\r
+ if EXIST "%PYTHONHOME%" (\r
+ set PYTHON_HOME=%PYTHONHOME%\r
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+ goto check_python_available\r
+ )\r
+)\r
+echo.\r
+echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist\r
+echo.\r
+goto end\r
+:check_python_available\r
+%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r
+ setlocal enabledelayedexpansion\r
+ set /p PythonCheck=<"PythonCheck.txt"\r
+ del PythonCheck.txt\r
+ if "!PythonCheck!" NEQ "TRUE" (\r
+ echo.\r
+ echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables\r
+ echo.\r
+ goto end\r
+ ) else (\r
+ goto check_freezer_path\r
+ )\r
+\r
+\r
+\r
+:check_freezer_path\r
+ endlocal\r
+\r
+ %PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL\r
+ if %ERRORLEVEL% EQU 0 (\r
+ goto use_pip_basetools\r
+ ) else (\r
+ REM reset ERRORLEVEL\r
+ type nul>nul\r
+ goto use_builtin_basetools\r