Skip to content

Commit 35309cb

Browse files
authored
prevent powershell from showing up at startup
1 parent eb8f738 commit 35309cb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

AssistantComputerControl/MainProgram.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ public static void TaskSchedulerSetup () {
437437
td.RegistrationInfo.Author = "Albert MN. | AssistantComputerControl";
438438
td.RegistrationInfo.Description = "AssistantComputerControl cleanup - clears the action folder to prevent the same action being executed twice";
439439

440-
td.Actions.Add(new ExecAction("powershell.exe", $"-WindowStyle Hidden -file \"{ps1File}\" \"{Path.Combine(MainProgram.CheckPath(), "*")}\" \"*.{Properties.Settings.Default.ActionFileExtension}\"", null));
441-
440+
td.Actions.Add(new ExecAction("mshta.exe", $"vbscript:Execute(\"CreateObject(\"\"WScript.Shell\"\").Run \"\"powershell -ExecutionPolicy Bypass & '{ps1File}' '{Path.Combine(MainProgram.CheckPath(), "*")}' '*.{Properties.Settings.Default.ActionFileExtension}'\"\", 0:close\")", null));
441+
442442
td.Triggers.Add(new LogonTrigger { UserId = userId, });
443443
ts.RootFolder.RegisterTaskDefinition(@"AssistantComputerControl cleanup", td);
444444
}
@@ -936,4 +936,4 @@ public static bool IsValidPath(string path, bool allowRelativePaths = false) {
936936
return isValid;
937937
}
938938
}
939-
}
939+
}

0 commit comments

Comments
 (0)