Browse Source

docs: enhance Windows installation instructions and features in README.md; improve PowerShell script for admin rights detection and user feedback

- Updated README.md to include new Windows installation features and manual installation instructions.
- Enhanced PowerShell installation script (install.ps1) to detect PowerShell version, handle elevation more effectively, and provide clearer user prompts for admin rights.
pull/85/head
Vaggelis kavouras 5 months ago
parent
commit
a9094d34dd
  1. 44
      README.md
  2. 35
      scripts/install.ps1

44
README.md

@ -63,11 +63,17 @@ this is a mistake.
curl -fsSL https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.sh | sudo bash
```
**Windows**: Copy and paste in PowerShell (Admin)
**Windows**: Copy and paste in PowerShell
```powershell
irm https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.ps1 | iex
```
#### Windows Installation Features:
- 🔍 Automatically detects and uses PowerShell 7 if available
- 🛡️ Requests administrator privileges via UAC prompt
- 📝 Falls back to Windows PowerShell if PS7 isn't found
- 💡 Provides manual instructions if elevation fails
That's it! The script will:
1. ✨ Install the tool automatically
2. 🔄 Reset your Cursor trial immediately
@ -175,15 +181,47 @@ this is a mistake.
curl -fsSL https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.sh | sudo bash
```
**Windows**: 在PowerShell(管理员)中复制粘贴
**Windows**: 在PowerShell中复制粘贴
```powershell
irm https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.ps1 | iex
```
就这样!脚本会:
#### Windows 安装特性:
- 🔍 自动检测并使用 PowerShell 7(如果可用)
- 🛡️ 通过 UAC 提示请求管理员权限
- 📝 如果没有 PS7 则使用 Windows PowerShell
- 💡 如果提权失败会提供手动说明
That's it! The script will:
1. ✨ 自动安装工具
2. 🔄 立即重置Cursor试用期
### 📦 Manual Installation
> Download the appropriate file for your system from [releases](https://github.com/dacrab/go-cursor-help/releases/latest)
<details>
<summary>Windows Packages</summary>
- 64-bit: `cursor-id-modifier_windows_x64.exe`
- 32-bit: `cursor-id-modifier_windows_x86.exe`
</details>
<details>
<summary>macOS Packages</summary>
- Intel: `cursor-id-modifier_darwin_x64_intel`
- M1/M2: `cursor-id-modifier_darwin_arm64_apple_silicon`
</details>
<details>
<summary>Linux Packages</summary>
- 64-bit: `cursor-id-modifier_linux_x64`
- 32-bit: `cursor-id-modifier_linux_x86`
- ARM64: `cursor-id-modifier_linux_arm64`
</details>
### 🔧 技术细节
<details>

35
scripts/install.ps1

@ -1,15 +1,30 @@
# Auto-elevate to admin rights if not already running as admin
# Check for admin rights and handle elevation
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-NOT $isAdmin) {
# Detect PowerShell version and path
$pwshPath = if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
(Get-Command "pwsh").Source # PowerShell 7+
} elseif (Test-Path "$env:ProgramFiles\PowerShell\7\pwsh.exe") {
"$env:ProgramFiles\PowerShell\7\pwsh.exe"
} else {
"powershell.exe" # Windows PowerShell
}
try {
Write-Host "Requesting administrator privileges..." -ForegroundColor Cyan
$argList = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
Start-Process powershell.exe -Verb RunAs -ArgumentList $argList -Wait
Write-Host "`nRequesting administrator privileges..." -ForegroundColor Cyan
$scriptPath = $MyInvocation.MyCommand.Path
$argList = "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`""
Start-Process -FilePath $pwshPath -Verb RunAs -ArgumentList $argList -Wait
exit
}
catch {
Write-Host "Failed to get admin rights. Please run as Administrator." -ForegroundColor Red
Write-Host "Press any key to exit..."
Write-Host "`nError: Administrator privileges required" -ForegroundColor Red
Write-Host "Please run this script from an Administrator PowerShell window" -ForegroundColor Yellow
Write-Host "`nTo do this:" -ForegroundColor Cyan
Write-Host "1. Press Win + X" -ForegroundColor White
Write-Host "2. Click 'Windows Terminal (Admin)' or 'PowerShell (Admin)'" -ForegroundColor White
Write-Host "3. Run the installation command again" -ForegroundColor White
Write-Host "`nPress enter to exit..."
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
exit 1
}
@ -33,7 +48,7 @@ function Cleanup {
trap {
Write-Host "Error: $_" -ForegroundColor Red
Cleanup
Write-Host "Press any key to exit..."
Write-Host "Press enter to exit..."
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
exit 1
}
@ -165,12 +180,14 @@ try {
catch {
Write-Host "Installation failed: $_" -ForegroundColor Red
Cleanup
Write-Host "Press any key to exit..."
Write-Host "Press enter to exit..."
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
exit 1
}
finally {
Cleanup
Write-Host "Press any key to exit..." -ForegroundColor Green
if ($LASTEXITCODE -ne 0) {
Write-Host "Press enter to exit..." -ForegroundColor Green
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
}
}
Loading…
Cancel
Save