Repository: microsoft/PowerToys
File: src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs (C#)

Code before:

                    // Using CurrentCulture since this is user facing
                    SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value),
                    IcoPath = IconPath,
                    Action = c =>
                    {
                        Execute(Process.Start, PrepareProcessStartInfo(m.Key));
                        return true;
                    },
                }).Take(5);
            return history.ToList();
        }

        private ProcessStartInfo PrepareProcessStartInfo(string command, RunAsType runAs = RunAsType.None)
        {
            string trimmedCommand = command.Trim();
            command = Environment.ExpandEnvironmentVariables(trimmedCommand);
            var workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

            // Set runAsArg
            string runAsVerbArg = string.Empty;
            if (runAs == RunAsType.OtherUser)
            {
                runAsVerbArg = "runAsUser";
            }
            else if (runAs == RunAsType.Administrator || !_settings.RunAsAdministrator)
            {
                runAsVerbArg = "runAs";
            }

            ProcessStartInfo info;
            if (_settings.Shell == ExecutionShell.Cmd)
            {
                var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause";

                info = ShellCommand.SetProcessStartInfo("cmd.exe", workingDirectory, arguments, runAsVerbArg);
            }
            else if (_settings.Shell == ExecutionShell.Powershell)
            {
                string arguments;
                if (_settings.LeaveShellOpen)
                {
                    arguments = $"-NoExit \"{command}\"";
                }
                else
                {
                    arguments = $"\"{command} ; Read-Host -Prompt \\\"Press Enter to continue\\\"\"";
                }

                info = ShellCommand.SetProcessStartInfo("powershell.exe", workingDirectory, arguments, runAsVerbArg);
            }

Review comment (suggestion):
```suggestion
            else if (runAs == RunAsType.Administrator || _settings.RunAsAdministrator)
```


Code after:

                    // Using CurrentCulture since this is user facing
                    SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value),
                    IcoPath = IconPath,
                    Action = c =>
                    {
                        Execute(Process.Start, PrepareProcessStartInfo(m.Key));
                        return true;
                    },
                }).Take(5);
            return history.ToList();
        }

        private ProcessStartInfo PrepareProcessStartInfo(string command, RunAsType runAs = RunAsType.None)
        {
            string trimmedCommand = command.Trim();
            command = Environment.ExpandEnvironmentVariables(trimmedCommand);
            var workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

            // Set runAsArg
            string runAsVerbArg = string.Empty;
            if (runAs == RunAsType.OtherUser)
            {
                runAsVerbArg = "runAsUser";
            }
            else if (runAs == RunAsType.Administrator || _settings.RunAsAdministrator)
            {
                runAsVerbArg = "runAs";
            }

            ProcessStartInfo info;
            if (_settings.Shell == ExecutionShell.Cmd)
            {
                var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause";

                info = ShellCommand.SetProcessStartInfo("cmd.exe", workingDirectory, arguments, runAsVerbArg);
            }
            else if (_settings.Shell == ExecutionShell.Powershell)
            {
                string arguments;
                if (_settings.LeaveShellOpen)
                {
                    arguments = $"-NoExit \"{command}\"";
                }
                else
                {
                    arguments = $"\"{command} ; Read-Host -Prompt \\\"Press Enter to continue\\\"\"";
                }

                info = ShellCommand.SetProcessStartInfo("powershell.exe", workingDirectory, arguments, runAsVerbArg);
            }