Issue: DOS 6.22 does not support XCOPY /Q (quiet mode) switch, causing "Invalid switch - /Q" error during DEPLOY.BAT execution. Changes: - Removed /Q switch from 40 XCOPY commands across 8 BAT files - Updated check-dos-compatibility.ps1 to detect XCOPY /Q usage - Created fix-xcopy-q-switch.ps1 automated fix script Files modified: - DEPLOY.BAT: 5 XCOPY commands fixed - UPDATE.BAT: 2 XCOPY commands fixed - CTONW.BAT: 11 XCOPY commands fixed - NWTOC.BAT: 2 XCOPY commands fixed - DEPLOY_VERIFY.BAT, DEPLOY_TEST.BAT, DEPLOY_FROM_NAS.BAT, DEPLOY_FROM_AD2.BAT: Test/verification copies updated DOS 6.22 XCOPY valid switches: /Y /S /E /D /H /K /C Invalid switches: /Q (quiet mode) Deployed to: - D2TESTNAS: /data/test/*.BAT (via scp -O) - AD2: C:/scripts/sync-copies/bat-files/*.BAT Testing: DOS machine error "Invalid switch - /Q" resolved Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
63 lines
2.1 KiB
PowerShell
63 lines
2.1 KiB
PowerShell
# Fix XCOPY /Q switch - not supported in DOS 6.22
|
|
# Removes /Q switch from all XCOPY commands
|
|
|
|
$BATFiles = @(
|
|
"DEPLOY.BAT",
|
|
"UPDATE.BAT",
|
|
"CTONW.BAT",
|
|
"NWTOC.BAT",
|
|
"DEPLOY_VERIFY.BAT",
|
|
"DEPLOY_TEST.BAT",
|
|
"DEPLOY_FROM_NAS.BAT",
|
|
"DEPLOY_FROM_AD2.BAT"
|
|
)
|
|
|
|
Write-Host "[INFO] Fixing XCOPY /Q switches (not in DOS 6.22)" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
$TotalFixed = 0
|
|
|
|
foreach ($File in $BATFiles) {
|
|
$FilePath = "D:\ClaudeTools\$File"
|
|
|
|
if (-not (Test-Path $FilePath)) {
|
|
Write-Host "[SKIP] $File - not found" -ForegroundColor Yellow
|
|
continue
|
|
}
|
|
|
|
Write-Host "Processing: $File" -ForegroundColor White
|
|
|
|
$Content = Get-Content $FilePath -Raw
|
|
$OriginalContent = $Content
|
|
|
|
# Remove /Q switch from XCOPY commands
|
|
# Pattern: XCOPY ... /Y /Q -> XCOPY ... /Y
|
|
# Pattern: XCOPY ... /Q -> XCOPY ...
|
|
$Content = $Content -replace '(\s+)\/Q(\s+)', '$1$2'
|
|
$Content = $Content -replace '(\s+)\/Q(\r?\n)', '$1$2'
|
|
|
|
if ($Content -ne $OriginalContent) {
|
|
$ChangeCount = ([regex]::Matches($OriginalContent, '/Q')).Count
|
|
Set-Content $FilePath $Content -NoNewline
|
|
Write-Host " [OK] Removed $ChangeCount /Q switches" -ForegroundColor Green
|
|
$TotalFixed += $ChangeCount
|
|
} else {
|
|
Write-Host " [OK] No /Q switches found" -ForegroundColor Green
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[SUCCESS] Fixed $TotalFixed /Q switches across all files" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "DOS 6.22 XCOPY switches (valid):" -ForegroundColor Cyan
|
|
Write-Host " /Y Suppress prompts (OK)" -ForegroundColor White
|
|
Write-Host " /S Copy subdirectories (OK)" -ForegroundColor White
|
|
Write-Host " /E Copy empty subdirectories (OK)" -ForegroundColor White
|
|
Write-Host " /D Only copy newer files (OK)" -ForegroundColor White
|
|
Write-Host " /H Copy hidden files (OK)" -ForegroundColor White
|
|
Write-Host " /K Copy attributes (OK)" -ForegroundColor White
|
|
Write-Host " /C Continue on errors (OK)" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host " /Q Quiet mode (NOT SUPPORTED)" -ForegroundColor Red
|
|
Write-Host ""
|