From fa41790682fcac1717134d402cc4dfe7d7afbe92 Mon Sep 17 00:00:00 2001 From: uroma Date: Thu, 22 Jan 2026 19:11:06 +0000 Subject: [PATCH] Fix Windows backup: Handle reserved device names (nul, con, prn, etc.) Windows has reserved device names that cannot be used as file names: - CON, PRN, AUX, NUL - COM1-9, LPT1-9 Changed backup function from Copy-Item to Robocopy which properly handles these reserved names. This fixes the error when backing up .claude directories that contain files with these names. Robocopy exit codes: - 0-7 = Success - 8+ = Errors Co-Authored-By: Claude --- install-windows.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/install-windows.ps1 b/install-windows.ps1 index 411a40a..1787686 100644 --- a/install-windows.ps1 +++ b/install-windows.ps1 @@ -150,8 +150,14 @@ function Backup-ExistingConfig { $backupDir = Join-Path $env:USERPROFILE ".claude-backup-$(Get-Date -Format 'yyyyMMdd_HHmmss')" if (Test-Path $claudeDir) { - Copy-Item -Path $claudeDir -Destination $backupDir -Recurse -Force - Write-ColorOutput "Backup created at: $backupDir" -Type Success + # Use Robocopy to handle reserved device names (nul, con, prn, etc.) + $robocopyResult = robocopy $claudeDir $backupDir /E /R:0 /W:0 /NFL /NDL /NJH /NJS 2>&1 + + if ($LASTEXITCODE -lt 8) { + Write-ColorOutput "Backup created at: $backupDir" -Type Success + } else { + Write-ColorOutput "Backup had some issues (continued anyway)." -Type Warning + } } else { Write-ColorOutput "No existing configuration to backup." -Type Info }