# 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 ""