Skip to content

Commit

Permalink
fix: combine schtasks command for faster execution
Browse files Browse the repository at this point in the history
  • Loading branch information
hichemfantar committed Nov 19, 2024
1 parent 48d9a05 commit c2687b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,20 @@ const createTask = async ({
}

try {
await execAsync(schtasksCommand);
// TODO: Add support for more advanced settings
await execAsync(
`$task = Get-ScheduledTask -TaskName "${taskName}"; $task.Settings.WakeToRun = $True; $task.Settings.DisallowStartIfOnBatteries = $False; $task.Settings.StopIfGoingOnBatteries = $False; $task | Set-ScheduledTask`,
`${schtasksCommand}; $task = Get-ScheduledTask -TaskName "${taskName}"; $task.Settings.WakeToRun = $True; $task.Settings.DisallowStartIfOnBatteries = $False; $task.Settings.StopIfGoingOnBatteries = $False; $task | Set-ScheduledTask;`,
{
shell: "powershell.exe",
}
);

// TODO: Add support for more advanced settings
// await execAsync(
// `$task = Get-ScheduledTask -TaskName "${taskName}"; $task.Settings.WakeToRun = $True; $task.Settings.DisallowStartIfOnBatteries = $False; $task.Settings.StopIfGoingOnBatteries = $False; $task | Set-ScheduledTask;`,
// {
// shell: "powershell.exe",
// }
// );
// await execAsync(
// `$task = Get-ScheduledTask -TaskName "${taskName}"; $task.Settings.WakeToRun = $True; $task | Set-ScheduledTask`,
// {
Expand Down

0 comments on commit c2687b0

Please sign in to comment.