@@ -11,11 +11,15 @@ setlocal enableextensions enabledelayedexpansion
1111set " MIN_ZIP_SIZE = 10000000"
1212set " DOWNLOAD_TIMEOUT_SEC = 120"
1313set " SCRIPT_VERSION = 2.2"
14+ if not defined ST_DEBUG set " ST_DEBUG = 0"
15+ set " LAUNCH_LOG = %TEMP% \SystemTester_launcher.log"
1416
1517:: =====================================================
1618:: Reliable admin detection and elevation
1719:: =====================================================
1820set " _ELEV_FLAG = %~1 "
21+ set " _DEBUG_FLAG = %~2 "
22+ if /i " %_DEBUG_FLAG% " == " debug" set " ST_DEBUG = 1"
1923
2024:: Primary admin check via PowerShell identity (works without Server service)
2125set " IS_ADMIN = "
4953echo Requesting elevation...
5054echo .
5155
52- powershell -NoProfile -ExecutionPolicy Bypass -Command " Start-Process -FilePath '%~f0 ' -ArgumentList '/elevated' -Verb RunAs -WorkingDirectory '%CD% ' -WindowStyle Normal"
56+ set " _ELEV_ARGS = /elevated"
57+ if " %ST_DEBUG% " == " 1" set " _ELEV_ARGS = /elevated debug"
58+ echo [%DATE% %TIME% ] Elevating: " %~f0 " %_ELEV_ARGS% ^ > ^ > " %LAUNCH_LOG% "
59+ powershell -NoProfile -ExecutionPolicy Bypass -Command " Start-Process -FilePath '%~f0 ' -ArgumentList '%_ELEV_ARGS% ' -Verb RunAs -WorkingDirectory '%CD% ' -WindowStyle Normal"
5360
5461if errorlevel 1 (
5562 echo [ERROR] Failed to elevate. Run manually as administrator.
@@ -113,6 +120,9 @@ if "%SCRIPT_PS1%"=="" (
113120)
114121
115122echo Using PowerShell script: %SCRIPT_PS1_NAME%
123+ if " %ST_DEBUG% " == " 1" (
124+ echo [%DATE% %TIME% ] Using PS1: " %SCRIPT_PS1% " ^ (exists: ^ < ^ %SCRIPT_PS1% ^^ ?^ ) >> " %LAUNCH_LOG% "
125+ )
116126echo .
117127
118128:: Check PowerShell version
@@ -180,7 +190,10 @@ echo STARTING INTERACTIVE MODE
180190echo ========================================================
181191echo .
182192pause
183- powershell -NoProfile -ExecutionPolicy Bypass -File " %SCRIPT_PS1% "
193+ set " PS_EXTRA = "
194+ if " %ST_DEBUG% " == " 1" set " PS_EXTRA = -NoExit"
195+ if " %ST_DEBUG% " == " 1" echo [%DATE% %TIME% ] Launching PS interactive: powershell -NoProfile -ExecutionPolicy Bypass %PS_EXTRA% -File " %SCRIPT_PS1% " >> " %LAUNCH_LOG% "
196+ powershell -NoProfile -ExecutionPolicy Bypass %PS_EXTRA% -File " %SCRIPT_PS1% "
184197echo .
185198if errorlevel 1 (
186199 echo [ERROR] Script failed (code: %errorlevel% )
@@ -202,7 +215,10 @@ echo May take 10-30 minutes depending on your system.
202215echo .
203216pause
204217echo .
205- powershell -NoProfile -ExecutionPolicy Bypass -File " %SCRIPT_PS1% " -AutoRun
218+ set " PS_EXTRA = "
219+ if " %ST_DEBUG% " == " 1" set " PS_EXTRA = -NoExit"
220+ if " %ST_DEBUG% " == " 1" echo [%DATE% %TIME% ] Launching PS autorun: powershell -NoProfile -ExecutionPolicy Bypass %PS_EXTRA% -File " %SCRIPT_PS1% " -AutoRun >> " %LAUNCH_LOG% "
221+ powershell -NoProfile -ExecutionPolicy Bypass %PS_EXTRA% -File " %SCRIPT_PS1% " -AutoRun
206222echo .
207223if errorlevel 1 (
208224 echo [ERROR] Tests failed (code: %errorlevel% )
0 commit comments