# Fix PAUSE command syntax - DOS 6.22 does not accept message parameters # Convert "PAUSE message..." to "ECHO message..." followed by "PAUSE" $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 "[INFO] Fixing PAUSE syntax (DOS 6.22 does not accept message)" -ForegroundColor Cyan Write-Host "" $TotalFixed = 0 foreach ($File in $BATFiles) { Write-Host "Processing: $($File.Name)" -ForegroundColor White $Lines = Get-Content $File.FullName $Modified = $false $NewLines = @() for ($i = 0; $i -lt $Lines.Count; $i++) { $Line = $Lines[$i] # Check if line starts with PAUSE followed by text if ($Line -match '^(\s*)PAUSE\s+(.+)$') { $Indent = $Matches[1] $Message = $Matches[2] # Replace with ECHO + PAUSE $NewLines += "${Indent}ECHO $Message" $NewLines += "${Indent}PAUSE" $Modified = $true $TotalFixed++ } else { $NewLines += $Line } } if ($Modified) { $NewLines | Set-Content $File.FullName Write-Host " [OK] Fixed PAUSE syntax" -ForegroundColor Green } else { Write-Host " [OK] No PAUSE issues found" -ForegroundColor Green } } Write-Host "" Write-Host "[SUCCESS] Fixed $TotalFixed PAUSE commands across all files" -ForegroundColor Green Write-Host "" Write-Host "DOS 6.22 PAUSE syntax:" -ForegroundColor Cyan Write-Host " CORRECT:" -ForegroundColor Green Write-Host " ECHO Press any key to continue..." -ForegroundColor White Write-Host " PAUSE" -ForegroundColor White Write-Host "" Write-Host " INCORRECT (Windows NT/2000+):" -ForegroundColor Red Write-Host " PAUSE Press any key to continue..." -ForegroundColor Red Write-Host ""