diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index 24d263578bc..66917d59413 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -237,6 +237,19 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin break; } + case Shell.Pwsh: + { + info.FileName = "pwsh.exe"; + if (_settings.LeaveShellOpen) + { + info.ArgumentList.Add("-NoExit"); + } + info.ArgumentList.Add("-Command"); + info.ArgumentList.Add(command); + + break; + } + case Shell.RunCommand: { var parts = command.Split(new[] diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs index a3cac1cb873..47b46055c7b 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs @@ -36,6 +36,6 @@ public enum Shell Cmd = 0, Powershell = 1, RunCommand = 2, - + Pwsh = 3, } } diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml index 39fb21c59cb..240bda95365 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml @@ -41,6 +41,7 @@ HorizontalAlignment="Left"> CMD PowerShell + Pwsh RunCommand diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs index 749e9ec80c9..ebb47dd1513 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs @@ -68,10 +68,23 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re) _settings.ReplaceWinR = false; }; - ShellComboBox.SelectedIndex = (int) _settings.Shell; + ShellComboBox.SelectedIndex = _settings.Shell switch + { + Shell.Cmd => 0, + Shell.Powershell => 1, + Shell.Pwsh => 2, + _ => ShellComboBox.Items.Count - 1 + }; + ShellComboBox.SelectionChanged += (o, e) => { - _settings.Shell = (Shell) ShellComboBox.SelectedIndex; + _settings.Shell = ShellComboBox.SelectedIndex switch + { + 0 => Shell.Cmd, + 1 => Shell.Powershell, + 2 => Shell.Pwsh, + _ => Shell.RunCommand + }; LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand; };