Files
claudetools/clients/dataforth/scripts/remove-pause-echo.ps1
Mike Swanson 5cbd49ce24 Reorganize repo: compartmentalize scripts by client/project
Move 150+ scripts from root and scripts/ into client/project directories:
- clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts)
- clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination)
- clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups)
- projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto)
- projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts)
- clients/glaztech/scripts/ (1 file: CentraStage removal)

Also reorganized:
- VPN scripts → infrastructure/vpn-configs/
- Retrieved API/JS files → api/
- Forum posts → projects/community-forum/forum-posts/
- SSH docs → clients/internal-infrastructure/docs/
- NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/
- ACG website files → projects/internal/acg-website-2025/
- Dataforth docs → clients/dataforth/docs/
- schema-retrieved.sql → docs/database/

Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history).
Root reduced from 220+ files to 62 items (docs + directories only).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:15:07 -07:00

47 lines
1.7 KiB
PowerShell

# Remove redundant ECHO lines before PAUSE
# DOS 6.22 PAUSE already displays "Press any key to continue..."
$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] Removing redundant ECHO before PAUSE" -ForegroundColor Cyan
Write-Host ""
$TotalRemoved = 0
foreach ($File in $BATFiles) {
Write-Host "Processing: $($File.Name)" -ForegroundColor White
$Content = Get-Content $File.FullName -Raw
# Remove "ECHO Press any key..." lines immediately before PAUSE
# Pattern: ECHO Press any key...\r?\n\s*PAUSE
$OriginalContent = $Content
$Content = $Content -replace 'ECHO Press any key[^\r\n]*\r?\n(\s*)PAUSE', '$1PAUSE'
if ($Content -ne $OriginalContent) {
$RemovedCount = ([regex]::Matches($OriginalContent, 'ECHO Press any key')).Count - ([regex]::Matches($Content, 'ECHO Press any key')).Count
Set-Content $File.FullName $Content -NoNewline
Write-Host " [OK] Removed $RemovedCount redundant ECHO lines" -ForegroundColor Green
$TotalRemoved += $RemovedCount
} else {
Write-Host " [OK] No redundant ECHO lines found" -ForegroundColor Green
}
}
Write-Host ""
Write-Host "[SUCCESS] Removed $TotalRemoved redundant ECHO lines" -ForegroundColor Green
Write-Host ""
Write-Host "DOS 6.22 PAUSE displays:" -ForegroundColor Cyan
Write-Host " 'Press any key to continue . . .'" -ForegroundColor White
Write-Host ""
Write-Host "No need for ECHO before PAUSE unless:" -ForegroundColor Cyan
Write-Host " - Custom message needed (not 'Press any key...')" -ForegroundColor White
Write-Host ""