Skip to content

Commit 06eb3c3

Browse files
authored
Handle both script names in batch launcher (#3)
1 parent 487ee71 commit 06eb3c3

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ powershell -ExecutionPolicy Bypass -File .\SystemTester.ps1
139139
powershell -ExecutionPolicy Bypass -File .\SystemTester.ps1 -AutoRun
140140
```
141141

142+
> ℹ️ **Launcher compatibility:** The batch launcher automatically detects either `SystemTester_FIXED.ps1` or the legacy `SystemTester.ps1` filename, so both naming conventions continue to work.
143+
142144
### **First-Time Setup**
143145

144146
If Sysinternals tools are missing:

SystemTester.bat

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ echo.
7474
:: Set paths
7575
set "SCRIPT_DIR=%cd%"
7676
set "DRIVE_LETTER=%~d0"
77-
set "SCRIPT_PS1=%SCRIPT_DIR%\SystemTester.ps1"
77+
78+
:: Locate PowerShell script (supports legacy and _FIXED names)
79+
set "SCRIPT_PS1="
80+
set "SCRIPT_PS1_NAME="
81+
if exist "%SCRIPT_DIR%\SystemTester_FIXED.ps1" (
82+
set "SCRIPT_PS1=%SCRIPT_DIR%\SystemTester_FIXED.ps1"
83+
set "SCRIPT_PS1_NAME=SystemTester_FIXED.ps1"
84+
) else if exist "%SCRIPT_DIR%\SystemTester.ps1" (
85+
set "SCRIPT_PS1=%SCRIPT_DIR%\SystemTester.ps1"
86+
set "SCRIPT_PS1_NAME=SystemTester.ps1"
87+
)
7888

7989
:: Check path length
8090
for /f %%i in ('powershell -NoProfile -Command "('%SCRIPT_DIR%').Length" 2^>nul') do set "PATH_LENGTH=%%i"
@@ -90,15 +100,22 @@ echo Path length: %PATH_LENGTH% characters
90100
echo.
91101

92102
:: Verify PowerShell script exists
93-
if not exist "%SCRIPT_PS1%" (
94-
echo [ERROR] PowerShell script not found: %SCRIPT_PS1%
103+
if "%SCRIPT_PS1%"=="" (
104+
echo [ERROR] PowerShell script not found in: %SCRIPT_DIR%
105+
echo.
106+
echo Expected one of the following files:
107+
echo - SystemTester_FIXED.ps1
108+
echo - SystemTester.ps1
95109
echo.
96-
echo Ensure SystemTester.ps1 is in the same folder.
110+
echo If you renamed the script, restore one of the supported names.
97111
echo.
98112
pause
99113
exit /b 1
100114
)
101115

116+
echo Using PowerShell script: %SCRIPT_PS1_NAME%
117+
echo.
118+
102119
:: Check PowerShell version
103120
echo Checking PowerShell...
104121
for /f "tokens=*" %%v in ('powershell -NoProfile -Command "$PSVersionTable.PSVersion.ToString()" 2^>nul') do set "PS_VERSION=%%v"

0 commit comments

Comments
 (0)