mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 12:32:06 +08:00
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.
This commit is contained in:
parent
ee2532175a
commit
a9094d34dd
44
README.md
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
|
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
|
```powershell
|
||||||
irm https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.ps1 | iex
|
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:
|
That's it! The script will:
|
||||||
1. ✨ Install the tool automatically
|
1. ✨ Install the tool automatically
|
||||||
2. 🔄 Reset your Cursor trial immediately
|
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
|
curl -fsSL https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.sh | sudo bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**Windows**: 在PowerShell(管理员)中复制粘贴
|
**Windows**: 在PowerShell中复制粘贴
|
||||||
```powershell
|
```powershell
|
||||||
irm https://raw.githubusercontent.com/dacrab/go-cursor-help/master/scripts/install.ps1 | iex
|
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. ✨ 自动安装工具
|
1. ✨ 自动安装工具
|
||||||
2. 🔄 立即重置Cursor试用期
|
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>
|
<details>
|
||||||
|
@ -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")
|
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
if (-NOT $isAdmin) {
|
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 {
|
try {
|
||||||
Write-Host "Requesting administrator privileges..." -ForegroundColor Cyan
|
Write-Host "`nRequesting administrator privileges..." -ForegroundColor Cyan
|
||||||
$argList = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
|
$scriptPath = $MyInvocation.MyCommand.Path
|
||||||
Start-Process powershell.exe -Verb RunAs -ArgumentList $argList -Wait
|
$argList = "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`""
|
||||||
|
Start-Process -FilePath $pwshPath -Verb RunAs -ArgumentList $argList -Wait
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "Failed to get admin rights. Please run as Administrator." -ForegroundColor Red
|
Write-Host "`nError: Administrator privileges required" -ForegroundColor Red
|
||||||
Write-Host "Press any key to exit..."
|
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')
|
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -33,7 +48,7 @@ function Cleanup {
|
|||||||
trap {
|
trap {
|
||||||
Write-Host "Error: $_" -ForegroundColor Red
|
Write-Host "Error: $_" -ForegroundColor Red
|
||||||
Cleanup
|
Cleanup
|
||||||
Write-Host "Press any key to exit..."
|
Write-Host "Press enter to exit..."
|
||||||
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -165,12 +180,14 @@ try {
|
|||||||
catch {
|
catch {
|
||||||
Write-Host "Installation failed: $_" -ForegroundColor Red
|
Write-Host "Installation failed: $_" -ForegroundColor Red
|
||||||
Cleanup
|
Cleanup
|
||||||
Write-Host "Press any key to exit..."
|
Write-Host "Press enter to exit..."
|
||||||
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
Cleanup
|
Cleanup
|
||||||
Write-Host "Press any key to exit..." -ForegroundColor Green
|
if ($LASTEXITCODE -ne 0) {
|
||||||
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
Write-Host "Press enter to exit..." -ForegroundColor Green
|
||||||
|
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user