Files
unlimitedcoding/codex/ucodex_uninstall.ps1
delta-cloud-208e 3381797148 fix(ps1): strip all non-ASCII Unicode from PowerShell scripts
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>
2026-04-21 10:53:15 +00:00

61 lines
2.3 KiB
PowerShell

# Codex CLI - Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1
$ErrorActionPreference = "Continue"
Write-Host ""
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host " | Codex CLI -- Windows Uninstaller |" -ForegroundColor Cyan
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host ""
# ---- Remove binary ----
$installDir = "$env:LOCALAPPDATA\Programs\codex"
if (Test-Path "$installDir\codex.exe") {
Write-Host " Stopping codex processes..." -ForegroundColor Cyan
Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force
Write-Host " Removing $installDir..." -ForegroundColor Cyan
Remove-Item -Recurse -Force $installDir
Write-Host " Binary removed" -ForegroundColor Green
# Remove from PATH
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -like "*$installDir*") {
$newPath = ($userPath -split ";" | Where-Object { $_ -ne $installDir }) -join ";"
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "User")
Write-Host " Removed from PATH" -ForegroundColor Green
}
} else {
Write-Host " Codex binary not found at $installDir" -ForegroundColor Yellow
# Check other common locations
$altPath = (Get-Command codex -ErrorAction SilentlyContinue).Source
if ($altPath) {
Write-Host " Found at: $altPath - remove manually" -ForegroundColor Yellow
}
}
# ---- Remove config ----
$codexDir = "$env:USERPROFILE\.codex"
if (Test-Path $codexDir) {
Write-Host " Removing $codexDir..." -ForegroundColor Cyan
Remove-Item -Recurse -Force $codexDir
Write-Host " Config removed" -ForegroundColor Green
} else {
Write-Host " No config directory found" -ForegroundColor Yellow
}
# ---- Remove env vars ----
Write-Host " Removing environment variables..." -ForegroundColor Cyan
[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", $null, "User")
[System.Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", $null, "User")
Remove-Item Env:OPENAI_API_KEY -ErrorAction SilentlyContinue
Remove-Item Env:OPENAI_BASE_URL -ErrorAction SilentlyContinue
Write-Host " Env vars removed" -ForegroundColor Green
Write-Host ""
Write-Host " Codex CLI fully uninstalled!" -ForegroundColor Green
Write-Host ""