mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 13:01:14 +00:00
29 lines
903 B
PowerShell
29 lines
903 B
PowerShell
function Get-QQpath {
|
|
try {
|
|
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
|
$uninstallString = $key.UninstallString
|
|
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
|
} catch {
|
|
throw "get QQ path error: $_"
|
|
}
|
|
}
|
|
$params = $args -join " "
|
|
Try {
|
|
$QQpath = Get-QQpath
|
|
} Catch {
|
|
$QQpath = Read-Host -Prompt "select QQ path"
|
|
if (!$QQpath) {
|
|
Write-Host "not select QQ path, exit"
|
|
exit
|
|
}
|
|
}
|
|
|
|
if (!(Test-Path $QQpath)) {
|
|
throw "provided QQ path is invalid: $QQpath"
|
|
}
|
|
|
|
$Bootfile = Join-Path $PSScriptRoot "napcat.cjs"
|
|
$env:ELECTRON_RUN_AS_NODE = 1
|
|
$commandInfo = Get-Command $QQpath -ErrorAction Stop
|
|
Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{& chcp 65001;& '$($commandInfo.Path)' $Bootfile $params}"
|