来源:互联网 更新时间:2026-07-18 07:51
官方下载地址:cursor.com/cn/download

官方文档:cursor.com/cn/docs/cli…
在Windows环境下,安装Cursor CLI通常是在powershell里跑一行命令就行:
复制代码irm 'https://cursor.com/install?win32=true' | iex
但默认的安装路径是固定的,它会自动丢到%LOCALAPPDATA%cursor-agent(也就是C:Users<用户名>AppDataLocalcursor-agent)。那么,怎么指定一个自己想要的文件夹呢?方法很简单:把官方脚本下载下来,手动修改里面的安装路径就行。
下载脚本的命令:
复制代码# git bash
curl -o cursor-install.ps1 "https://cursor.com/install?win32=true"# powershell
irm "https://cursor.com/install?win32=true" -OutFile ".cursor-install.ps1"
下载下来的脚本长这样(关键部分已保留):
复制代码$downloadUrl = 'https://downloads.cursor.com/lab/2026.07.16-899851b/'
$version = '2026.07.16-899851b'
function Get-Architecture {
# NB: We do it this way to protect against WOW64 redirection - i.e.
# if the user accidentally is in 32-bit or 64-bit Intel Powershell,
# we don't want to be fibbed to
$systemType = (Get-WmiObject Win32_ComputerSystem).SystemType
if ($systemType -like "*ARM64*") { return "arm64" } else { return "x64" }
}
function Download-InstallPackage {
param(
[string]$UrlPrefix,
[string]$TargetPath,
[string]$Version
)
$tempFile = "$TargetPath$([System.Guid]::NewGuid().ToString()).zip"
$architecture = Get-Architecture
$fullUrl = $UrlPrefix + "windows/$architecture/agent-cli-package.zip"
try {
Invoke-WebRequest -Uri $fullUrl -OutFile $tempFile
Expand-Archive -Path $tempFile -DestinationPath $TargetPath -Force
Rename-Item -Path "$TargetPathdist-package" -NewName $Version
# Copy all files that begin with 'cursor-agent' to the root dir
Get-ChildItem -Path "$TargetPath$Version" -Filter 'cursor-agent*' | Copy-Item -Destination "$TargetPath.."
# Create agent alias (primary command) for cursor-agent
$rootDir = "$TargetPath.."
if (Test-Path "$rootDircursor-agent.exe") {
Copy-Item -Path "$rootDircursor-agent.exe" -Destination "$rootDiragent.exe" -Force
}
if (Test-Path "$rootDircursor-agent.cmd") {
Copy-Item -Path "$rootDircursor-agent.cmd" -Destination "$rootDiragent.cmd" -Force
}
if (Test-Path "$rootDircursor-agent.ps1") {
Copy-Item -Path "$rootDircursor-agent.ps1" -Destination "$rootDiragent.ps1" -Force
}
}
finally {
if (Test-Path $tempFile) {
Remove-Item $tempFile
}
}
}
function Initialize-CursorAgent {
## initially set up the cursor-agent directory
## Create %LocalAppData%cursor-agentversions
## Add %LocalAppData%cursor-agent to PATH
$agentPath = "$env:LOCALAPPDATAcursor-agent"
$versionsPath = "$agentPathversions"
# If $agentPath exists, delete it
if (Test-Path $agentPath) {
Remove-Item -Recurse -Force $agentPath
}
New-Item -ItemType Directory -Path $agentPath -Force | Out-Null
New-Item -ItemType Directory -Path $versionsPath -Force | Out-Null
# Add to PATH
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$agentPath*") {
[Environment]::SetEnvironmentVariable("PATH", "$currentPath;$agentPath", "User")
}
# Add to current shell PATH
if ($env:PATH -notlike "*$agentPath*") {
$env:PATH = "$env:PATH;$agentPath"
}
}
function Print-CursorAgentInstructions {
Write-Host "Start using Cursor Agent:"
Write-Host " agent"
Write-Host ""
Write-Host ""
Write-Host "Happy coding!"
Write-Host ""
}
Initialize-CursorAgent
Download-InstallPackage -UrlPrefix $downloadUrl -TargetPath "$env:LOCALAPPDATAcursor-agentversions" -Version $version
Print-CursorAgentInstructions
注意脚本里第51行和第83行,分别定义了$agentPath和Download-InstallPackage中的$TargetPath,默认都指向了$env:LOCALAPPDATAcursor-agent。要改安装路径,直接把这俩改成你想要的目录就行,比如:
复制代码...
$agentPath = "D:appsCursorCLI"
...
Download-InstallPackage -UrlPrefix $downloadUrl -TargetPath "D:appsCursorCLIversions" -Version $version
...
改完之后,在powershell里执行下载的脚本即可:
复制代码.cursor-install.ps1
安装成功之后,就可以在powershell里用agent命令来启动Cursor CLI了。
其实安装脚本已经自动把安装路径加到了Windows的环境变量里,所以理论上在git bash里直接运行agent.cmd也能用。但问题在于,git bash默认不会去读Windows的PATHEXT环境变量,所以直接敲agent是没反应的。
解决方案也很简单,配置一下~/.bash_profile文件,加个别名就行:
复制代码alias agent='<安装路径>/agent.cmd'
# 例如:alias agent='/d/apps/CursorCLI/agent.cmd'
保存之后,重新打开git bash,就可以愉快地用agent命令来调用Cursor CLI了。
黄金价格不断创新高!黄金稳定币XAU、PAXG市值达11亿美元
新浪机器学习热点小时报丨2026年07月25日18时_今日实时机器学习热点速递
CC币价格预测(2026-2035):Canton币今日价格走势+长期价格预测
新浪互联网热点小时报丨2026年07月26日16时_今日实时互联网热点速递
腾讯ima怎么创建共享知识库?
今日比特币暴涨分析:Metaplanet的比特币BTC投资推动股价上涨17%
蚂蚁庄园今日答案7月21日(今日已更新) 蚂蚁庄园今天正确答案是什么呢
区块链OTC交易所有哪几家比较正规?
2026热门直线加速赛车手游推荐:高人气、爽快加速体验的精品榜单
腾讯ima怎么把微信内容一键导入知识库?
kimi提示词专家使用方法新手指南
Intel喜讯连连:18A工艺良率提升到85%、CPU将涨价15%
原神霜月三处月灵龛具体位置汇总
《幻兽帕鲁》不触发通缉捕捉传说商人方法
Windy卫星云图怎么看?云层变化识别技巧
新浪人工智能热点小时报丨2026年07月30日18时_今日实时人工智能热点速递
为什么推特KOL都在BRC20赚钱 我一冲就亏?
抖音怎么取消申请退货退款?抖音上取消退货怎么操作
一加手机如何设置三指长按屏幕局部截图
合集38个项目筹集5.406亿美元 Figure融资2亿
手机号码测吉凶
本站所有软件,都由网友上传,如有侵犯你的版权,请发邮件haolingcc@hotmail.com 联系删除。 版权所有 Copyright@2012-2013 haoling.cc