mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
fix: no admin rights on Windows (#933)
This commit is contained in:
parent
db605f24fc
commit
6bdb133cea
@ -84,7 +84,7 @@ export async function enableAutoRun(): Promise<void> {
|
||||
const taskFilePath = path.join(tmpdir(), `${appName}.xml`)
|
||||
await writeFile(taskFilePath, Buffer.from(`\ufeff${getTaskXml()}`, 'utf-16le'))
|
||||
await execPromise(
|
||||
`%SystemRoot%\\System32\\schtasks.exe /create /tn "${appName}" /xml "${taskFilePath}" /f`
|
||||
`powershell Start-Process schtasks -Verb RunAs -ArgumentList '/create', '/tn', '${appName}', '/xml', '${taskFilePath}', '/f'`
|
||||
)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
@ -121,7 +121,7 @@ Categories=Utility;
|
||||
export async function disableAutoRun(): Promise<void> {
|
||||
if (process.platform === 'win32') {
|
||||
const execPromise = promisify(exec)
|
||||
await execPromise(`%SystemRoot%\\System32\\schtasks.exe /delete /tn "${appName}" /f`)
|
||||
await execPromise(`powershell Start-Process schtasks -Verb RunAs -ArgumentList '/delete', '/tn', '${appName}', '/f'`)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
const execPromise = promisify(exec)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user