From 7ea76b8539eb27964e851d41b8574e96ff6031fb Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 15 Jun 2025 16:25:16 +0800 Subject: [PATCH] Support administrator handling for ShellRun api function --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 3 +++ Flow.Launcher/PublicAPIInstance.cs | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 788255cfb..b447d369f 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -42,6 +42,9 @@ namespace Flow.Launcher.Plugin /// /// Run a shell command /// + /// + /// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator. + /// /// The command or program to run /// the shell type to run, e.g. powershell.exe /// Thrown when unable to find the file specified in the command diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 50a5f8311..d1e500792 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -158,8 +158,7 @@ namespace Flow.Launcher { var args = filename == "cmd.exe" ? $"/C {cmd}" : $"{cmd}"; - var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true); - ShellCommand.Execute(startInfo); + StartProcess(filename, arguments: args, createNoWindow: true); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")]