Electron to run a Windows 10 (APPX) from windows store


#1

Can electron start a app that is downloaded from Windows 10 Store?

I know I can run simple exe’s with:
const {spawn} = require(‘child_process’);
const app = spawn(executablePath);


#2

It would have been the easiest to simply give it a try before asking. If it doesn’t work by default, check the default file association for .appx in the Registry Editor. Presumably that’s in HKEY_CLASSES_ROOT\.appx (I’m not using Windows, so I can’t check.)


#3

nope, you are on a very wrong track here.
.appx is not a file and it does not have a valid path
There is no real path to execute.
This is why I’m asking.


#4

I use Windows, but I’ve never downloaded anything from the Windows Store so I don’t have knowledge of how those apps work. Is it possible to create a desktop shortcut that invokes an app? If so, then you can use that shortcut to invoke the app.


#5

That is a workaround that could help. If there is no other elaborate way of running those apps, I might work with that idea. Thanks


#6

Out of interest, I booted my old Windows 10 machine and installed Trello (because it’s free) from the Windows Store. I’ve learned a couple of things that might help you reach your goal:

  1. Apps from the Windows Store are installed to %ProgramFiles%\WindowsApps. This folder is protected by default, so I’m not sure if the following will work without getting access first

  2. You somehow need to get the package ID of such an app. This looks like the trickiest part in the equation, since the ID is subject to change. Among other things, it contains the current version of the app. Update: Take a look at these PowerShell cmdlets for Appx

  3. Once you got the ID, you can query the path for its application at HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages

  4. At this path, you will find AppxManifest.xml, which reveals the location of the app’s executable

Example:

<Application Id="trello" Executable="app\Trello.exe" EntryPoint="Windows.FullTrustApplication">
    <!-- contents omitted -->
</Application>

You can now use child_process.spawn() to launch the app.

If you learn anything new along the process, please share it so others can use that knowledge!


#8

I took this as an inspiration to make get-appx-path :smiley:

const getAppxPath = require('get-appx-path');
 
// Application ID
const appID = 'SpotifyAB.SpotifyMusic';
 
(async () => {
    try {
        const appx = await getAppxPath(appID);
        console.log(appx.path);
    } catch (err) {
        console.error(err);
    }
})();

#9

Hi, nice, I should check this out :slight_smile: