我发现还是有很多人烦恼于 Cursor 的自动升级,这里说一个简单的方法
我前段时间手动整理C盘文件,发现了C:\Users\用户名\AppData\Local\cursor-updater
把它其中的内容全部删除,在属性里设置Everyone权限为拒绝修改
其他系统应该是类似的,让各位补充吧,我趁着吃饭的间隙来发个帖子,所以没有图文教程了
–过了一个小时–
晚来的人有福了,补一个PowerShell脚本,应该是需要管理员权限的
function Check-Permission {
param ([string]$Path)
$acl = Get-Acl $Path -ErrorAction SilentlyContinue
if ($acl) {
foreach ($rule in $acl.Access) {
if ($rule.IdentityReference -eq "Everyone" -and
$rule.FileSystemRights -eq "Modify" -and
$rule.AccessControlType -eq "Deny") {
return $true
}
}
}
return $false
} if (Test-Path $folderPath) {
if (Check-Permission -Path $folderPath) {
Write-Host "目标文件夹已设置 Everyone 的'修改'拒绝权限,无需重复设置。" -ForegroundColor Yellow
} else {
Write-Host "目标文件夹未设置权限,将进行设置..." -ForegroundColor Cyan
Remove-Item -Path $folderPath* -Recurse -Force
$acl = Get-Acl $folderPath
$denyRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Everyone",
"Modify",
"ContainerInherit,ObjectInherit",
"None",
"Deny"
)
$acl.SetAccessRule($denyRule)
Set-Acl -Path $folderPath -AclObject $acl
Write-Host "权限设置完成:已拒绝 Everyone 的'修改'权限。" -ForegroundColor Green
}
} else {
Write-Host "目标文件夹不存在,正在创建并设置权限..." -ForegroundColor Cyan
New-Item -ItemType Directory -Path $folderPath | Out-Null
$acl = Get-Acl $folderPath
$denyRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Everyone",
"Modify",
"ContainerInherit,ObjectInherit",
"None",
"Deny"
)
$acl.SetAccessRule($denyRule)
Set-Acl -Path $folderPath -AclObject $acl
Write-Host "权限设置完成:已拒绝 Everyone 的'修改'权限。" -ForegroundColor Green
}
多行
$folderPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath "cursor-updater"
一行
$folderPath=Join-Path -Path $env:LOCALAPPDATA -ChildPath "cursor-updater";function Check-Permission{param([string]$Path);$acl=Get-Acl $Path -ErrorAction SilentlyContinue;if($acl){foreach($rule in $acl.Access){if($rule.IdentityReference -eq "Everyone" -and $rule.FileSystemRights -eq "Modify" -and $rule.AccessControlType -eq "Deny"){return $true}}}return $false};if(Test-Path $folderPath){if(Check-Permission -Path $folderPath){Write-Host "目标文件夹已设置 Everyone 的'修改'拒绝权限,无需重复设置。" -ForegroundColor Yellow}else{Write-Host "目标文件夹未设置权限,将进行设置..." -ForegroundColor Cyan;Remove-Item -Path $folderPath\* -Recurse -Force;$acl=Get-Acl $folderPath;$denyRule=New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone","Modify","ContainerInherit,ObjectInherit","None","Deny");$acl.SetAccessRule($denyRule);Set-Acl -Path $folderPath -AclObject $acl;Write-Host "权限设置完成:已拒绝 Everyone 的'修改'权限。" -ForegroundColor Green}}else{Write-Host "目标文件夹不存在,正在创建并设置权限..." -ForegroundColor Cyan;New-Item -ItemType Directory -Path $folderPath|Out-Null;$acl=Get-Acl $folderPath;$denyRule=New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone","Modify","ContainerInherit,ObjectInherit","None","Deny");$acl.SetAccessRule($denyRule);Set-Acl -Path $folderPath -AclObject $acl;Write-Host "权限设置完成:已拒绝 Everyone 的'修改'权限。" -ForegroundColor Green}
Cursor 自动升级禁用方案之一
内容版权声明:除非注明,否则皆为本站原创文章。