diff --git a/src/Files.App/Helpers/Win32/Win32Helper.Process.cs b/src/Files.App/Helpers/Win32/Win32Helper.Process.cs index f4e0feb9f228..1f73eeb9d795 100644 --- a/src/Files.App/Helpers/Win32/Win32Helper.Process.cs +++ b/src/Files.App/Helpers/Win32/Win32Helper.Process.cs @@ -46,22 +46,40 @@ public static async Task InvokeWin32ComponentAsync(string applicationPath, public static async Task InvokeWin32ComponentsAsync(IEnumerable applicationPaths, IShellPage associatedInstance, string arguments = null, bool runAsAdmin = false, string workingDirectory = null) { - Debug.WriteLine("Launching EXE in FullTrustProcess"); - if (string.IsNullOrEmpty(workingDirectory)) - { workingDirectory = associatedInstance.ShellViewModel.WorkingDirectory; - } var application = applicationPaths.FirstOrDefault(); if (string.IsNullOrEmpty(workingDirectory)) - { workingDirectory = associatedInstance?.ShellViewModel?.WorkingDirectory; - } if (runAsAdmin) { - return await LaunchHelper.LaunchAppAsync(application, "RunAs", workingDirectory); + // TODO In the long run, we should consider modifying HandleApplicationLaunch to handle this correctly. + try + { + ProcessStartInfo startInfo = new ProcessStartInfo + { + FileName = application, + Arguments = arguments, + Verb = "runas", + WorkingDirectory = workingDirectory, + UseShellExecute = true + }; + + Process process = new Process + { + StartInfo = startInfo + }; + + process.Start(); + + return true; + } + catch (Exception) + { + return false; + } } else {