9

I have created an application using Electron, one feature of which is that user can add files to it(copied to application's data directory).

When user wants to open file from application's UI, I am able to open file using Electron's shell module: shell.openItem().

Now I want to give user an option to trigger system's "Open With" dialog(shown below for windows) from where user can choose with which application user want's to open the file. I search docs for Electron and googled it but not able to find a way to trigger this dialog. Any idea how this can be done for all platforms electron supports. Solution which involves calling an OS specific command to trigger this dialog is also as good.

enter image description here

Harshveer Singh
  • 4,037
  • 7
  • 37
  • 45
  • 2
    Did you ever figure it out, or found a reasonable work around? – vsimkus Mar 21 '20 at 11:20
  • I did it by via Node: `child_process.exec(\`powershell.exe RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL "${filePath}"\`)`. Only works on Windows. I think this is an undocumented command and maybe there is some better way to do it, but it does work. [source](https://stackoverflow.com/questions/23566667/launch-associated-program-or-show-open-with-dialog-from-another-program) – JamieGL Mar 03 '22 at 17:43

0 Answers0