2dust 2024-03-31 07:54:22 +08:00
parent edbc850346
commit 13bc2d0340
1 changed files with 3 additions and 3 deletions

View File

@ -1029,14 +1029,14 @@ namespace v2rayN
if (run) if (run)
{ {
string exePath = $"\"{GetExePath()}\""; string exePath = GetExePath();
if (IsAdministrator()) if (IsAdministrator())
{ {
AutoStart(autoRunName, exePath, ""); AutoStart(autoRunName, exePath, "");
} }
else else
{ {
RegWriteValue(AutoRunRegPath, autoRunName, exePath); RegWriteValue(AutoRunRegPath, autoRunName, exePath.AppendQuotes());
} }
} }
} }
@ -1136,7 +1136,7 @@ namespace v2rayN
task.Settings.ExecutionTimeLimit = TimeSpan.Zero; task.Settings.ExecutionTimeLimit = TimeSpan.Zero;
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromSeconds(10) }); task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromSeconds(10) });
task.Principal.RunLevel = TaskRunLevel.Highest; task.Principal.RunLevel = TaskRunLevel.Highest;
task.Actions.Add(new ExecAction(deamonFileName, null, Path.GetDirectoryName(deamonFileName))); task.Actions.Add(new ExecAction(deamonFileName.AppendQuotes(), null, Path.GetDirectoryName(deamonFileName)));
taskService.RootFolder.RegisterTaskDefinition(TaskName, task); taskService.RootFolder.RegisterTaskDefinition(TaskName, task);
} }