-@if /I "%1"=="-h" goto Usage\r
-@if /I "%1"=="-help" goto Usage\r
-@if /I "%1"=="--help" goto Usage\r
-@if /I "%1"=="/h" goto Usage\r
-@if /I "%1"=="/?" goto Usage\r
-@if /I "%1"=="/help" goto Usage\r
+if /I "%1"=="-h" goto Usage\r
+if /I "%1"=="-help" goto Usage\r
+if /I "%1"=="--help" goto Usage\r
+if /I "%1"=="/h" goto Usage\r
+if /I "%1"=="/?" goto Usage\r
+if /I "%1"=="/help" goto Usage\r
+\r
+if /I "%1"=="NewBuild" shift\r
+if not defined EDK_TOOLS_PATH (\r
+ goto SetEdkToolsPath\r
+) else (\r
+ goto checkNt32Flag\r
+)\r
+\r
+:SetEdkToolsPath\r
+if %WORKSPACE:~-1% EQU \ (\r
+ @set EDK_BASETOOLS=%WORKSPACE%BaseTools\r
+) else (\r
+ @set EDK_BASETOOLS=%WORKSPACE%\BaseTools\r
+)\r
+if exist %EDK_BASETOOLS% (\r
+ set EDK_TOOLS_PATH=%EDK_BASETOOLS%\r
+ set EDK_BASETOOLS=\r
+) else (\r
+ if defined PACKAGES_PATH (\r
+ for %%i IN (%PACKAGES_PATH%) DO (\r
+ if exist %%~fi\BaseTools (\r
+ set EDK_TOOLS_PATH=%%~fi\BaseTools\r
+ goto checkNt32Flag\r
+ )\r
+ )\r
+ ) else (\r
+ echo.\r
+ echo !!! ERROR !!! Cannot find BaseTools !!!\r
+ echo.\r
+ goto BadBaseTools\r
+ )\r
+)\r