MSDN says that starting in Windows 10, it is not possible to call SHOpenWithDialog to set the file association for the specified format.
When I tried to invoke the following two commands, neither of the "Open With" dialog boxes were able to set the file association.%1 is a full file path.
OpenWith.exe -override "%1"rundll32.exe shell32.dll,OpenAs_RunDLL "%1"
I tried to start a process using the "openas" verb and the "Open With" dialog displayed, thus will have a check box named "Always open with this application," as-if clicking "Open With" from a file's context menu. But that will open the file, and an exception is thrown for an extension with no file association set.
public static void ShowOpenWithDialog(string extension)
{
string tempPath = $"{Path.GetTempPath()}{Guid.NewGuid()}{extension}";
File.WriteAllText(tempPath, "");
using(Process process = new Process())
{
process.StartInfo = new ProcessStartInfo
{
UseShellExecute = true,
FileName = tempPath,
Verb = "openas"
};
process.Start();
}
File.Delete(tempPath);
}
I want to know, how can I call the "Open With" dialog used to associate file formats? Bandizip can do it!
I found a screenshot of an English language display system that sets up file associations for specified file types in Settings, like this.

