mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
parent
b38bd8d1f8
commit
94c126b601
|
@ -36,7 +36,7 @@ if (process.platform === 'win32' && !is.dev && !process.argv.includes('noadmin')
|
|||
if (!existsSync(path.join(taskDir(), 'mihomo-party-run.exe'))) {
|
||||
throw new Error('mihomo-party-run.exe not found')
|
||||
} else {
|
||||
execSync('C:\\\\Windows\\System32\\schtasks.exe /run /tn mihomo-party-run')
|
||||
execSync('%SystemRoot%\\System32\\schtasks.exe /run /tn mihomo-party-run')
|
||||
}
|
||||
} catch (e) {
|
||||
let createErrorStr = `${createError}`
|
||||
|
|
|
@ -54,7 +54,7 @@ export async function checkAutoRun(): Promise<boolean> {
|
|||
const execPromise = promisify(exec)
|
||||
try {
|
||||
const { stdout } = await execPromise(
|
||||
`chcp 437 && C:\\\\Windows\\System32\\schtasks.exe /query /tn "${appName}"`
|
||||
`chcp 437 && %SystemRoot%\\System32\\schtasks.exe /query /tn "${appName}"`
|
||||
)
|
||||
return stdout.includes(appName)
|
||||
} catch (e) {
|
||||
|
@ -82,7 +82,7 @@ export async function enableAutoRun(): Promise<void> {
|
|||
const taskFilePath = path.join(taskDir(), `${appName}.xml`)
|
||||
await writeFile(taskFilePath, Buffer.from(`\ufeff${taskXml}`, 'utf-16le'))
|
||||
await execPromise(
|
||||
`C:\\\\Windows\\System32\\schtasks.exe /create /tn "${appName}" /xml "${taskFilePath}" /f`
|
||||
`%SystemRoot%\\System32\\schtasks.exe /create /tn "${appName}" /xml "${taskFilePath}" /f`
|
||||
)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
|
@ -119,7 +119,7 @@ Categories=Utility;
|
|||
export async function disableAutoRun(): Promise<void> {
|
||||
if (process.platform === 'win32') {
|
||||
const execPromise = promisify(exec)
|
||||
await execPromise(`C:\\\\Windows\\System32\\schtasks.exe /delete /tn "${appName}" /f`)
|
||||
await execPromise(`%SystemRoot%\\System32\\schtasks.exe /delete /tn "${appName}" /f`)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
const execPromise = promisify(exec)
|
||||
|
|
|
@ -109,6 +109,6 @@ export function createElevateTask(): void {
|
|||
path.join(taskDir(), 'mihomo-party-run.exe')
|
||||
)
|
||||
execSync(
|
||||
`C:\\\\Windows\\System32\\schtasks.exe /create /tn "mihomo-party-run" /xml "${taskFilePath}" /f`
|
||||
`%SystemRoot%\\System32\\schtasks.exe /create /tn "mihomo-party-run" /xml "${taskFilePath}" /f`
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user