一步一步教你如何在Git Bash中安装配置使用Cursor CLI的详细完整操作教程指南
在Windows下,CursorCLI默认安装到本地应用数据目录的cursor-agent文件夹。下载官方脚本,修改两变量自定义安装路径,执行安装。安装后,在gitbash配置bash配置文件以使用agent命令。
Cursor CLI 下载与安装指南
Cursor CLI官方下载地址:cursor.com/cn/download

Cursor CLI官方文档:cursor.com/cn/docs/cli…
如何自定义Cursor 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。
在Git Bash中配置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。
你是一名 AI 行业编辑,请围绕下面这条热点输出一份资讯解读:
热点:一步一步教你如何在Git Bash中安装配置使用Cursor CLI的详细完整操作教程指南要求:
1. 先用一句话解释这条热点在讲什么
2. 再总结它为什么重要
3. 说明会影响哪些 AI 产品或内容方向
4. 最后给出 3 个适合资讯站使用的标题
游乐网为非赢利性网站,所展示的游戏/软件/文章内容均来自于互联网或第三方用户上传分享,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系youleyoucom@outlook.com。
相关热点通过标签与限定符组合检索,可精准定位知识库信息。使用@锁定范围、 缩小语义、时间词限定新鲜度,并核验答案出处避免幻觉。打好标签、用好限定符、核验出处三者缺一不可。
得物App联合千觉机器人在WAIC2026发布全球首款AI鉴别机器人,基于数十亿条样本和自研AI大脑,实现细粒度视觉感知,鉴别结果与人工一致性超99 9999%,5秒内完成鞋履等多品类全流程闭环鉴别。
使用搜狐简单AI稳定变形人物图,需在提示词开头声明【面部特征完全保留】,用括号锁定不可变形部位,禁用模糊词改用具体参照。重绘时需精准框选目标区域,分步操作避免全局混淆。
使用堆友AI生成电商商品图需进入正确入口,上传纯白背景、1000×1000像素以上的产品实拍图并完成智能抠图。选择模板或自定义背景,开启产品阴影,调整尺寸和角度,生成后检查边缘和阴影,下载PNG文件。全程约2分钟可产出合规高清图。
- 日榜
- 周榜
- 月榜
热点快看
