fix: Remove all non-DOS 6.22 commands from batch files

Critical compatibility fixes - DOS 6.22 does not support many Windows
batch file features. Removed all incompatible commands and replaced
with DOS 6.22 compatible alternatives.

Issues Fixed:

1. DEPLOY.BAT - Removed SET /P (interactive input)
   - Changed from: SET /P MACHINE=Machine name:
   - Changed to: SET MACHINE=%1 (command-line parameter)
   - Usage: DEPLOY.BAT TS-4R
   - DOS 6.22 does not support SET /P

2. CHECKUPD.BAT - Removed SET /A (arithmetic) and GOTO :EOF
   - Removed 6 instances of SET /A counter arithmetic
   - Replaced numeric counters with flag variables
   - Changed from: SET /A COMMON=COMMON+1
   - Changed to: SET COMMON=FOUND
   - Replaced GOTO :EOF with actual labels
   - Changed display from counts to status messages

3. STAGE.BAT - Removed FOR /F (file parsing)
   - Changed from: FOR /F "skip=1 delims=" %%L IN (...) DO
   - Changed to: TYPE C:\AUTOEXEC.BAT >> C:\AUTOEXEC.TMP
   - DOS 6.22 only supports simple FOR loops

Created check-dos-compatibility.ps1:
- Automated scanner for DOS 6.22 incompatible commands
- Checks for: SET /P, SET /A, IF /I, FOR /F, FOR /L, FOR /R,
  GOTO :EOF, %COMPUTERNAME%, &&, ||, START, invalid NUL usage
- Scans all BAT files and reports line numbers
- Essential for preventing future compatibility issues

Verification:
- All files maintain CRLF line terminators
- All commands tested for DOS 6.22 compatibility
- No SET /A, SET /P, FOR /F, GOTO :EOF remaining
- CHOICE commands retained (CHOICE.COM exists in DOS 6.22)

Impact:
- DEPLOY.BAT now requires parameter: DEPLOY.BAT TS-4R
- CHECKUPD.BAT shows "Updates available" vs exact counts
- STAGE.BAT copies all AUTOEXEC lines (duplicate @ECHO OFF harmless)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 16:52:43 -07:00
parent 925a769786
commit 116778cad9
4 changed files with 126 additions and 50 deletions

View File

@@ -0,0 +1,69 @@
# Comprehensive DOS 6.22 compatibility checker
# Scans all BAT files for incompatible commands
$BATFiles = Get-ChildItem *.BAT | Where-Object { $_.Name -notlike "*_FROM_*" -and $_.Name -notlike "*_TEST*" -and $_.Name -notlike "*_VERIFY*" -and $_.Name -notlike "*_CHECK*" -and $_.Name -notlike "*_MONITOR*" }
Write-Host "========================================" -ForegroundColor Red
Write-Host "DOS 6.22 COMPATIBILITY CHECK" -ForegroundColor Red
Write-Host "========================================" -ForegroundColor Red
Write-Host ""
$TotalIssues = 0
# DOS 6.22 INCOMPATIBLE patterns
$IncompatiblePatterns = @(
@{Pattern='SET\s+/P'; Description='SET /P (interactive input) - NOT in DOS 6.22'},
@{Pattern='SET\s+/A'; Description='SET /A (arithmetic) - NOT in DOS 6.22'},
@{Pattern='IF\s+/I'; Description='IF /I (case-insensitive) - NOT in DOS 6.22'},
@{Pattern='FOR\s+/F'; Description='FOR /F (parse files) - NOT in DOS 6.22'},
@{Pattern='FOR\s+/L'; Description='FOR /L (loop) - NOT in DOS 6.22'},
@{Pattern='FOR\s+/D'; Description='FOR /D (directories) - NOT in DOS 6.22'},
@{Pattern='FOR\s+/R'; Description='FOR /R (recursive) - NOT in DOS 6.22'},
@{Pattern='GOTO\s+:EOF'; Description='GOTO :EOF - NOT in DOS 6.22 (use GOTO END)'},
@{Pattern='%COMPUTERNAME%'; Description='%COMPUTERNAME% - NOT in DOS 6.22'},
@{Pattern='%USERNAME%'; Description='%USERNAME% - NOT in DOS 6.22'},
@{Pattern='%USERPROFILE%'; Description='%USERPROFILE% - NOT in DOS 6.22'},
@{Pattern='&&'; Description='&& operator - NOT in DOS 6.22'},
@{Pattern='\|\|'; Description='|| operator - NOT in DOS 6.22'},
@{Pattern='\\NUL(?!\s|$)'; Description='\NUL as filename - INVALID (use \*.* for directory test)'},
@{Pattern='CHOICE\s+/[A-Z]'; Description='CHOICE with options - Check if CHOICE.COM available'},
@{Pattern='START\s+'; Description='START command - NOT in DOS 6.22'}
)
foreach ($File in $BATFiles) {
Write-Host "Checking: $($File.Name)" -ForegroundColor Cyan
$Content = Get-Content $File.FullName
$FileIssues = 0
foreach ($Pattern in $IncompatiblePatterns) {
$LineNum = 0
foreach ($Line in $Content) {
$LineNum++
if ($Line -match $Pattern.Pattern) {
if ($FileIssues -eq 0) {
Write-Host ""
}
Write-Host " [ERROR] Line $LineNum : $($Pattern.Description)" -ForegroundColor Red
Write-Host " > $Line" -ForegroundColor Yellow
$FileIssues++
$TotalIssues++
}
}
}
if ($FileIssues -eq 0) {
Write-Host " [OK] No incompatibilities found" -ForegroundColor Green
}
Write-Host ""
}
Write-Host "========================================" -ForegroundColor Red
Write-Host "TOTAL ISSUES FOUND: $TotalIssues" -ForegroundColor Red
Write-Host "========================================" -ForegroundColor Red
if ($TotalIssues -gt 0) {
Write-Host ""
Write-Host "ACTION REQUIRED: Fix all incompatibilities before deployment" -ForegroundColor Red
}