Windows PowerShell 5.1 reads .ps1 files without BOM as Windows-1251 by default. Em-dashes (-) and other Unicode chars in string literals get mangled into invalid bytes (e.g. "session - no" becomes garbage that breaks the parser with "Unexpected token" errors. Replaced em-dash, en-dash, smart quotes, ellipsis, NBSP and arrows with their ASCII equivalents across all 12 .ps1 scripts (install/update/ uninstall for claude/gemini/codex/qwen). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.9 KiB
PowerShell
52 lines
1.9 KiB
PowerShell
# Claude Code - Windows Uninstaller
|
|
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host ""
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host " | Claude Code -- Windows Uninstaller |" -ForegroundColor Cyan
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# ---- Uninstall npm package ----
|
|
|
|
Write-Host " Removing @anthropic-ai/claude-code..." -ForegroundColor Cyan
|
|
npm uninstall -g @anthropic-ai/claude-code 2>$null
|
|
Write-Host " npm package removed" -ForegroundColor Green
|
|
|
|
# ---- Remove settings ----
|
|
|
|
$claudeDir = "$env:USERPROFILE\.claude"
|
|
if (Test-Path $claudeDir) {
|
|
Write-Host " Removing $claudeDir..." -ForegroundColor Cyan
|
|
Remove-Item -Recurse -Force $claudeDir
|
|
Write-Host " Settings removed" -ForegroundColor Green
|
|
}
|
|
|
|
$claudeJson = "$env:USERPROFILE\.claude.json"
|
|
if (Test-Path $claudeJson) {
|
|
Remove-Item -Force $claudeJson
|
|
Write-Host " Removed .claude.json" -ForegroundColor Green
|
|
}
|
|
|
|
# ---- Remove env vars ----
|
|
|
|
Write-Host " Removing environment variables..." -ForegroundColor Cyan
|
|
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", $null, "User")
|
|
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $null, "User")
|
|
[System.Environment]::SetEnvironmentVariable("CLAUDE_CODE_USE_BEDROCK", $null, "User")
|
|
Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
|
|
Remove-Item Env:ANTHROPIC_BASE_URL -ErrorAction SilentlyContinue
|
|
Write-Host " Env vars removed" -ForegroundColor Green
|
|
|
|
# ---- Remove npm registry config ----
|
|
|
|
Write-Host " Removing npm registry config..." -ForegroundColor Cyan
|
|
npm config delete "@anthropic-ai:registry" 2>$null
|
|
Write-Host " Registry config removed" -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host " Claude Code fully uninstalled!" -ForegroundColor Green
|
|
Write-Host ""
|