# 把 Cursor Agent 窗口改成简体中文。先退出 Cursor,写入 molten 语言和窗口模式,再重新打开。 # 用法: powershell -ExecutionPolicy Bypass -File .\Set-CursorAgentZh.ps1 $ErrorActionPreference = "Stop" $log = Join-Path $PSScriptRoot "Set-CursorAgentZh.log" function Write-Log([string]$Message) { $line = "{0} {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message Add-Content -LiteralPath $log -Value $line -Encoding UTF8 } Start-Sleep -Seconds 8 $fallback = "D:\Program Files\cursor\Cursor.exe" $running = @(Get-CimInstance Win32_Process -Filter "Name = 'Cursor.exe'" | Where-Object { $_.ExecutablePath }) if ($running.Count -gt 0) { $exe = $running[0].ExecutablePath } else { $exe = $fallback } Write-Log "closing $exe" Get-Process -Name Cursor -ErrorAction SilentlyContinue | ForEach-Object { [void]$_.CloseMainWindow() } $deadline = (Get-Date).AddSeconds(12) while ((Get-Process -Name Cursor -ErrorAction SilentlyContinue) -and (Get-Date) -lt $deadline) { Start-Sleep -Milliseconds 400 } $left = @(Get-Process -Name Cursor -ErrorAction SilentlyContinue) if ($left.Count -gt 0) { Write-Log "force stop $($left.Count)" $left | Stop-Process -Force Start-Sleep -Seconds 1 } $pythonCmd = Get-Command python -ErrorAction SilentlyContinue if ($pythonCmd) { $python = $pythonCmd.Source } else { $python = "D:\SoftwareSpace\uv\bin\python.exe" } $py = Join-Path $PSScriptRoot "set-cursor-zh.py" & $python $py Write-Log "python exit $LASTEXITCODE" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Start-Process -FilePath $exe Write-Log "started $exe"