xfvsdf/qqbot
0
1# 检测是否为管理员2$IsElevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).3 IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)4 5# Skip Scoop install if already present to avoid stopping the script6if (Get-Command scoop -ErrorAction SilentlyContinue) {7 Write-Host "Scoop is already installed. Skipping installation."8} else {9 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force10 if ($IsElevated) {11 # 管理员:使用官方一行命令并传入 -RunAsAdmin12 Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"13 } else {14 # 普通用户安装15 Invoke-WebRequest -useb get.scoop.sh | Invoke-Expression16 }17}18 19scoop install git uv20if (Test-Path -LiteralPath "./web.py") {21 # Already in target directory; skip clone and cd22}23elseif (Test-Path -LiteralPath "./gcli2api/web.py") {24 Set-Location ./gcli2api25}26else {27 git clone https://github.com/su-kaka/gcli2api.git28 Set-Location ./gcli2api29}30uv sync31.venv/Scripts/activate.ps132python web.py