Skip to content

Commit 0b13bc5

Browse files
authored
Update SystemTester.bat
1 parent a0cd51a commit 0b13bc5

1 file changed

Lines changed: 85 additions & 30 deletions

File tree

SystemTester.bat

Lines changed: 85 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ setlocal enableextensions enabledelayedexpansion
44
:: =====================================================
55
:: Portable Sysinternals System Tester Launcher
66
:: Created by Pacific Northwest Computers - 2025
7-
:: Production Ready Version - v2.2
7+
:: Production Ready Version - v2.2 (FIXED)
88
:: =====================================================
99

1010
:: Constants
1111
set "MIN_ZIP_SIZE=10000000"
12-
REM ^-- Minimum expected ZIP size (~10MB) for validation
1312
set "DOWNLOAD_TIMEOUT_SEC=120"
1413
set "SCRIPT_VERSION=2.2"
1514

@@ -49,7 +48,7 @@ echo.
4948

5049
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -ArgumentList '/elevated' -Verb RunAs"
5150

52-
if errorlevel 1 (
51+
if %errorlevel% neq 0 (
5352
echo [ERROR] Failed to elevate. Run manually as administrator.
5453
pause
5554
)
@@ -61,7 +60,7 @@ color 0B
6160

6261
:: Change to script directory
6362
cd /d "%~dp0" 2>nul
64-
if errorlevel 1 (
63+
if %errorlevel% neq 0 (
6564
echo [ERROR] Cannot access directory: %~dp0
6665
pause
6766
exit /b 1
@@ -112,7 +111,7 @@ if "%PS_VERSION%"=="" (
112111
echo PowerShell version: %PS_VERSION%
113112
echo.
114113

115-
:: Check for Sysinternals folder (FIXED: Removed duplicate)
114+
:: FIXED: Check for Sysinternals folder (removed duplicate)
116115
if not exist "%SCRIPT_DIR%\Sysinternals" (
117116
echo [WARNING] Sysinternals folder not found!
118117
echo Use Menu Option 5 to download automatically.
@@ -176,7 +175,7 @@ echo.
176175
pause
177176
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_PS1%"
178177
echo.
179-
if errorlevel 1 (
178+
if %errorlevel% neq 0 (
180179
echo [ERROR] Script failed (code: %errorlevel%)
181180
pause
182181
) else (
@@ -198,7 +197,7 @@ pause
198197
echo.
199198
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_PS1%" -AutoRun
200199
echo.
201-
if errorlevel 1 (
200+
if %errorlevel% neq 0 (
202201
echo [ERROR] Tests failed (code: %errorlevel%)
203202
pause
204203
) else (
@@ -266,7 +265,7 @@ echo.
266265
echo Downloading...
267266
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ProgressPreference='SilentlyContinue'; try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%ZIP_FILE%' -TimeoutSec %DOWNLOAD_TIMEOUT_SEC%; Write-Host 'Download complete' -ForegroundColor Green } catch { Write-Host ('ERROR: ' + $_.Exception.Message) -ForegroundColor Red; exit 1 }"
268267

269-
if errorlevel 1 (
268+
if %errorlevel% neq 0 (
270269
echo.
271270
echo Download failed. Check internet connection.
272271
if exist "%ZIP_FILE%" del "%ZIP_FILE%" 2>nul
@@ -340,13 +339,14 @@ echo --------------------------------------------------------
340339
echo INSTALLED TOOLS:
341340
echo --------------------------------------------------------
342341

343-
:: Check GPU-Z with size validation
342+
:: FIXED: Check GPU-Z with size validation
344343
if exist "%GPUZ_PATH%" (
345344
for %%A in ("%GPUZ_PATH%") do set "GPUZ_SIZE=%%~zA"
346345
if !GPUZ_SIZE! GTR 1000000 (
347346
echo [OK] GPU-Z.exe - Installed ^(!GPUZ_SIZE! bytes^)
348347
) else (
349348
echo [!] GPU-Z.exe - File exists but seems corrupted ^(!GPUZ_SIZE! bytes^)
349+
echo Expected size: ^>1MB. Re-download recommended.
350350
)
351351
) else (
352352
echo [ ] GPU-Z.exe - Not installed
@@ -358,14 +358,19 @@ if exist "C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe" (
358358
echo [ ] NVIDIA-SMI - Not installed ^(NVIDIA GPU drivers^)
359359
)
360360

361-
:: Check for AMD tools (FIXED: Check multiple registry keys)
361+
:: FIXED: Check for AMD tools (check ALL registry subkeys)
362362
set "AMD_FOUND="
363363
for /f "tokens=*" %%K in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}" /s 2^>nul ^| find "HKEY_"') do (
364364
reg query "%%K" /v DriverDesc 2>nul | find /i "AMD" >nul 2>&1
365365
if not errorlevel 1 (
366366
set "AMD_FOUND=YES"
367367
goto :AMD_FOUND
368368
)
369+
reg query "%%K" /v DriverDesc 2>nul | find /i "Radeon" >nul 2>&1
370+
if not errorlevel 1 (
371+
set "AMD_FOUND=YES"
372+
goto :AMD_FOUND
373+
)
369374
)
370375
:AMD_FOUND
371376
if defined AMD_FOUND (
@@ -403,7 +408,10 @@ if exist "%GPUZ_PATH%" (
403408
echo Size: !GPUZ_SIZE! bytes
404409
if !GPUZ_SIZE! LSS 1000000 (
405410
echo [WARNING] File seems too small. May be corrupted.
411+
echo Expected size: ^>1MB
406412
echo Re-download if GPU-Z doesn't work properly.
413+
) else (
414+
echo [OK] File size looks good
407415
)
408416
)
409417
echo.
@@ -429,7 +437,7 @@ echo.
429437
echo Creating Tools directory...
430438
if not exist "%GPU_TOOLS_DIR%" (
431439
mkdir "%GPU_TOOLS_DIR%" 2>nul
432-
if errorlevel 1 (
440+
if %errorlevel% neq 0 (
433441
echo [ERROR] Cannot create directory: %GPU_TOOLS_DIR%
434442
pause
435443
goto GPU_TOOLS
@@ -450,6 +458,7 @@ echo 2. Save it to: %GPU_TOOLS_DIR%
450458
echo 3. Rename it to: GPU-Z.exe
451459
echo.
452460
echo Full path should be: %GPUZ_PATH%
461+
echo Expected file size: 5-10 MB
453462
echo.
454463
echo NOTE: TechPowerUp doesn't provide direct download links,
455464
echo so manual download is required.
@@ -508,35 +517,69 @@ echo AMD TOOLS VERIFICATION
508517
echo ========================================================
509518
echo.
510519

511-
:: Check for AMD GPU (FIXED: Check all registry subkeys)
520+
:: FIXED: Check for AMD GPU (check ALL registry subkeys)
512521
set "AMD_FOUND="
513522
set "AMD_NAME="
514523
set "AMD_DRIVER_VERSION="
515524
set "AMD_DRIVER_DATE="
525+
set "AMD_COUNT=0"
526+
527+
echo Scanning for AMD GPUs in all registry locations...
528+
echo.
516529

517530
for /f "tokens=*" %%K in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}" /s 2^>nul ^| find "HKEY_"') do (
518531
for /f "tokens=2*" %%a in ('reg query "%%K" /v DriverDesc 2^>nul ^| find "DriverDesc"') do (
519532
echo %%b | find /i "AMD" >nul 2>&1
520533
if not errorlevel 1 (
521534
set "AMD_FOUND=YES"
522-
set "AMD_NAME=%%b"
535+
set /a AMD_COUNT+=1
536+
537+
echo [AMD GPU #!AMD_COUNT!]
538+
echo Device: %%b
539+
540+
:: Get driver version
541+
for /f "tokens=2*" %%v in ('reg query "%%K" /v DriverVersion 2^>nul ^| find "DriverVersion"') do (
542+
echo Driver Version: %%w
543+
)
523544

524-
:: Get driver version and date
525-
for /f "tokens=2*" %%v in ('reg query "%%K" /v DriverVersion 2^>nul ^| find "DriverVersion"') do set "AMD_DRIVER_VERSION=%%w"
526-
for /f "tokens=2*" %%d in ('reg query "%%K" /v DriverDate 2^>nul ^| find "DriverDate"') do set "AMD_DRIVER_DATE=%%d"
527-
goto :AMD_INFO_FOUND
545+
:: Get driver date
546+
for /f "tokens=2*" %%d in ('reg query "%%K" /v DriverDate 2^>nul ^| find "DriverDate"') do (
547+
echo Driver Date: %%d
548+
)
549+
550+
:: Get registry key location
551+
echo Registry Key: %%K
552+
echo.
553+
) else (
554+
echo %%b | find /i "Radeon" >nul 2>&1
555+
if not errorlevel 1 (
556+
set "AMD_FOUND=YES"
557+
set /a AMD_COUNT+=1
558+
559+
echo [AMD GPU #!AMD_COUNT!]
560+
echo Device: %%b
561+
562+
:: Get driver version
563+
for /f "tokens=2*" %%v in ('reg query "%%K" /v DriverVersion 2^>nul ^| find "DriverVersion"') do (
564+
echo Driver Version: %%w
565+
)
566+
567+
:: Get driver date
568+
for /f "tokens=2*" %%d in ('reg query "%%K" /v DriverDate 2^>nul ^| find "DriverDate"') do (
569+
echo Driver Date: %%d
570+
)
571+
572+
:: Get registry key location
573+
echo Registry Key: %%K
574+
echo.
575+
)
528576
)
529577
)
530578
)
531579

532-
:AMD_INFO_FOUND
533580
if defined AMD_FOUND (
534-
echo [OK] AMD GPU Detected: %AMD_NAME%
535-
echo.
536-
echo AMD Driver Information:
537581
echo ========================================================
538-
if defined AMD_DRIVER_VERSION echo Driver Version: %AMD_DRIVER_VERSION%
539-
if defined AMD_DRIVER_DATE echo Driver Date: %AMD_DRIVER_DATE%
582+
echo Total AMD GPUs detected: %AMD_COUNT%
540583
echo ========================================================
541584
echo.
542585
echo NOTE: AMD doesn't provide a command-line tool like
@@ -554,6 +597,7 @@ if defined AMD_FOUND (
554597
echo If you have an AMD GPU but it's not detected:
555598
echo 1. Update AMD drivers from: https://www.amd.com/en/support
556599
echo 2. Use AMD Auto-Detect tool
600+
echo 3. Check Device Manager for display adapters
557601
echo.
558602
echo If you don't have an AMD GPU, this is normal.
559603
)
@@ -649,14 +693,17 @@ echo ========================================================
649693
echo HELP / TROUBLESHOOTING GUIDE v%SCRIPT_VERSION%
650694
echo ========================================================
651695
echo.
652-
echo NEW IN v2.2:
696+
echo NEW IN v2.2 (FIXED):
653697
echo - Tool integrity verification (digital signatures)
654698
echo - Dual report system (Clean + Detailed)
655699
echo - Fixed memory usage calculation bug
656700
echo - Launcher awareness detection
657701
echo - Enhanced GPU testing with vendor-specific tools
658702
echo - GPU Tools Manager (Menu Option 6)
659-
echo - Improved AMD GPU detection for multi-GPU systems
703+
echo - FIXED: AMD GPU detection now checks ALL registry keys
704+
echo - FIXED: GPU-Z size validation added
705+
echo - FIXED: Removed duplicate Sysinternals check
706+
echo - FIXED: Consistent errorlevel checking
660707
echo.
661708
echo --------------------------------------------------------
662709
echo COMMON ISSUES:
@@ -688,9 +735,9 @@ echo PSPing enables: Bandwidth testing, TCP latency
688735
echo.
689736
echo 7. TESTS TAKE TOO LONG
690737
echo Expected durations:
691-
echo - CPU Test: 10 seconds
692-
echo - Network Speed: 30-60 seconds
693-
echo - Energy Report: 15 seconds
738+
echo - CPU Test: 30 seconds
739+
echo - Disk Test: 10-30 seconds
740+
echo - Energy Report: 20 seconds (configurable)
694741
echo - Windows Update: 30-90 seconds
695742
echo - DISM/SFC: 5-15 minutes each
696743
echo.
@@ -705,8 +752,16 @@ echo Limit: 260 characters
705752
echo Solution: Move to C:\SysTest\
706753
echo.
707754
echo 10. AMD GPU NOT DETECTED
708-
echo - Script now checks ALL registry subkeys
709-
echo - Update AMD drivers if still not found
755+
echo FIXED: Script now checks ALL registry subkeys
756+
echo If still not detected:
757+
echo - Update AMD drivers
758+
echo - Check Device Manager
759+
echo - Verify GPU is enabled
760+
echo.
761+
echo 11. GPU-Z FILE CORRUPTED
762+
echo FIXED: Script now validates file size
763+
echo Expected: 5-10 MB
764+
echo If corrupted, re-download from TechPowerUp
710765
echo.
711766
echo --------------------------------------------------------
712767
echo FEATURES:

0 commit comments

Comments
 (0)