Support administrator handling for ShellRun api function

This commit is contained in:
Jack251970 2025-06-15 16:25:16 +08:00
parent 3493446d3e
commit 7ea76b8539
2 changed files with 4 additions and 2 deletions

View file

@ -42,6 +42,9 @@ namespace Flow.Launcher.Plugin
/// <summary>
/// Run a shell command
/// </summary>
/// <remarks>
/// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator.
/// </remarks>
/// <param name="cmd">The command or program to run</param>
/// <param name="filename">the shell type to run, e.g. powershell.exe</param>
/// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>

View file

@ -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 = "<Pending>")]