Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions scripts/install-cursor-agent-cli-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
param(
[string]$InstallUrl = "https://cursor.com/install?win32=true"
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

# $IsWindows exists in PowerShell Core; fall back for Windows PowerShell 5.x.
$runningOnWindows = $false
if (Get-Variable -Name IsWindows -ErrorAction SilentlyContinue) {
$runningOnWindows = [bool]$IsWindows
}
else {
$runningOnWindows = $env:OS -eq "Windows_NT"
}

if (-not $runningOnWindows) {
throw "This installer script is intended for Windows only."
}

Write-Host "Installing Cursor Agent CLI from $InstallUrl ..."

try {
# Cursor publishes an official PowerShell installer for Windows.
$installerScript = Invoke-RestMethod -Uri $InstallUrl -Method Get
if ([string]::IsNullOrWhiteSpace([string]$installerScript)) {
throw "Installer payload was empty."
}
Invoke-Expression $installerScript
}
catch {
throw "Cursor Agent CLI installation failed: $($_.Exception.Message)"
}

# Refresh PATH in this process for immediate verification.
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" +
[System.Environment]::GetEnvironmentVariable("Path", "User")

$agentCmd = Get-Command agent -ErrorAction SilentlyContinue
if (-not $agentCmd) {
Write-Warning "Install completed, but 'agent' was not found in PATH for this shell yet."
Write-Host "Open a new PowerShell window and run: agent --version"
exit 0
}

Write-Host "Installation complete."
& agent --version