diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
index 2a4a400c6..426bb407c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
@@ -54,6 +54,11 @@ namespace Flow.Launcher.Plugin.Explorer
contextMenus.Add(CreateOpenContainingFolderResult(record));
+ if (record.Type == ResultType.File)
+ {
+ contextMenus.Add(CreateOpenWithMenu(record));
+ }
+
if (record.WindowsIndexed)
{
contextMenus.Add(CreateOpenWindowsIndexingOptions());
@@ -434,6 +439,22 @@ namespace Flow.Launcher.Plugin.Explorer
};
}
+ private Result CreateOpenWithMenu(SearchResult record)
+ {
+ return new Result
+ {
+ Title = Context.API.GetTranslation("plugin_explorer_openwith"),
+ SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
+ Action = _ =>
+ {
+ Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
+ return true;
+ },
+ IcoPath = Constants.ShowContextMenuImagePath,
+ Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue7ac"),
+ };
+ }
+
private void LogException(string message, Exception e)
{
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index d5352ef1e..f2491d928 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -102,7 +102,9 @@
Remove from Quick Access
Remove current item from Quick Access
Show Windows Context Menu
-
+ Open With
+ Select a program to open with
+
{0} free of {1}
Open in Default File Manager
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
index 9a692cac3..52aaf3c27 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
@@ -3,6 +3,8 @@
xmlns:system="clr-namespace:System;assembly=mscorlib">
Replace Win+R
+ Close Command Prompt after pressing any key
+ Press any key to close this window...
Do not close Command Prompt after command execution
Always run as administrator
Run as different user
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
index 16ea2b0a9..645622821 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
@@ -203,7 +203,7 @@ namespace Flow.Launcher.Plugin.Shell
case Shell.Cmd:
{
info.FileName = "cmd.exe";
- info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}";
+ info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command} {(_settings.CloseShellAfterPress ? $"&& echo {context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")} && pause > nul /c" : "")}";
//// Use info.Arguments instead of info.ArgumentList to enable users better control over the arguments they are writing.
//// Previous code using ArgumentList, commands needed to be separated correctly:
@@ -232,7 +232,7 @@ namespace Flow.Launcher.Plugin.Shell
else
{
info.ArgumentList.Add("-Command");
- info.ArgumentList.Add(command);
+ info.ArgumentList.Add($"{command}; {(_settings.CloseShellAfterPress ? $"Write-Host '{context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'; [System.Console]::ReadKey(); exit" : "")}");
}
break;
}
@@ -245,7 +245,7 @@ namespace Flow.Launcher.Plugin.Shell
info.ArgumentList.Add("-NoExit");
}
info.ArgumentList.Add("-Command");
- info.ArgumentList.Add(command);
+ info.ArgumentList.Add($"{command}; {(_settings.CloseShellAfterPress ? $"Write-Host '{context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'; [System.Console]::ReadKey(); exit" : "")}");
break;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
index 47b46055c..6f47d5d17 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
@@ -7,6 +7,8 @@ namespace Flow.Launcher.Plugin.Shell
public Shell Shell { get; set; } = Shell.Cmd;
public bool ReplaceWinR { get; set; } = false;
+
+ public bool CloseShellAfterPress { get; set; } = false;
public bool LeaveShellOpen { get; set; }
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
index 240bda953..2f02ef723 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
@@ -15,6 +15,7 @@
+
+
CMD
@@ -44,7 +51,7 @@
Pwsh
RunCommand
-
+
+ {
+ _settings.CloseShellAfterPress = true;
+ LeaveShellOpen.IsChecked = false;
+ LeaveShellOpen.IsEnabled = false;
+ };
+
+ CloseShellAfterPress.Unchecked += (o, e) =>
+ {
+ _settings.CloseShellAfterPress = false;
+ LeaveShellOpen.IsEnabled = true;
+ };
+
LeaveShellOpen.Checked += (o, e) =>
{
_settings.LeaveShellOpen = true;
+ CloseShellAfterPress.IsChecked = false;
+ CloseShellAfterPress.IsEnabled = false;
};
LeaveShellOpen.Unchecked += (o, e) =>
{
_settings.LeaveShellOpen = false;
+ CloseShellAfterPress.IsEnabled = true;
};
AlwaysRunAsAdministrator.Checked += (o, e) =>