Can openPath API open file without using default app?

I can use openPath API to open file, for example, I opened a jpg file and openPath API called Photos application as my image viewer because it is my default application to view image in Windows10.

If I want to use Paint to view image instead of using Photos and don’t want to adjust the default viewer’s setting from Windows10, how can I achieve this goal by using Electron?

Is there any Electron API can use or any workaround?

I would explore using an automation script for this instead of Electron.

You can try Actiona or AutoHotKey. These emulate the user actions for your desktop workflow.

You can also embed these in Electron wrapper.