mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
refactor: boot script
This commit is contained in:
parent
b21fbad8a3
commit
3692d1499f
@ -3,6 +3,7 @@
|
|||||||
QQ Version: Windows 9.9.9-23424 / Linux 3.2.7-23361
|
QQ Version: Windows 9.9.9-23424 / Linux 3.2.7-23361
|
||||||
|
|
||||||
## 修复与优化
|
## 修复与优化
|
||||||
|
* 优化启动脚本
|
||||||
|
|
||||||
## 新增与调整
|
## 新增与调整
|
||||||
* 修复快速重启进程清理问题
|
* 修复快速重启进程清理问题
|
||||||
|
@ -2,14 +2,28 @@ function Get-QQpath {
|
|||||||
try {
|
try {
|
||||||
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
||||||
$uninstallString = $key.UninstallString
|
$uninstallString = $key.UninstallString
|
||||||
|
throw "get QQ path error:"
|
||||||
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
||||||
}
|
} catch {
|
||||||
catch {
|
throw "get QQ path error: $_"
|
||||||
return "D:\QQ.exe"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$params = $args -join " "
|
$params = $args -join " "
|
||||||
|
Try {
|
||||||
$QQpath = Get-QQpath
|
$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"
|
$Bootfile = Join-Path $PSScriptRoot "napcat.cjs"
|
||||||
$env:ELECTRON_RUN_AS_NODE = 1
|
$env:ELECTRON_RUN_AS_NODE = 1
|
||||||
Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{& chcp 65001;& '$QQpath' $Bootfile $params}"
|
$commandInfo = Get-Command $QQpath -ErrorAction Stop
|
||||||
|
Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{& chcp 65001;& '$($commandInfo.Path)' $Bootfile $params}"
|
||||||
|
@ -2,14 +2,28 @@ function Get-QQpath {
|
|||||||
try {
|
try {
|
||||||
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
$key = Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ"
|
||||||
$uninstallString = $key.UninstallString
|
$uninstallString = $key.UninstallString
|
||||||
|
throw "get QQ path error:"
|
||||||
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
return [System.IO.Path]::GetDirectoryName($uninstallString) + "\QQ.exe"
|
||||||
}
|
} catch {
|
||||||
catch {
|
throw "get QQ path error: $_"
|
||||||
return "D:\QQ.exe"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$params = $args -join " "
|
$params = $args -join " "
|
||||||
|
Try {
|
||||||
$QQpath = Get-QQpath
|
$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"
|
$Bootfile = Join-Path $PSScriptRoot "napcat.cjs"
|
||||||
$env:ELECTRON_RUN_AS_NODE = 1
|
$env:ELECTRON_RUN_AS_NODE = 1
|
||||||
Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{& '$QQpath' $Bootfile $params}"
|
$commandInfo = Get-Command $QQpath -ErrorAction Stop
|
||||||
|
Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{& '$($commandInfo.Path)' $Bootfile $params}"
|
Loading…
x
Reference in New Issue
Block a user