25

Window Store apps are not like the classic Windows apps. The latter usually are installed at clear paths under C:\Program Files. So, AutoHotKey (AHK) scripts can simply run a classic app by "Run" with the path to the app executable. However, it seems there is no simple path to Windows Store app executables. So, how to start Windows Store apps in AutoHotKey scripts with a simple way?

Meng-Yuan Huang
  • 1,943
  • 3
  • 19
  • 23

9 Answers9

32

Assume the OS is Windows 10. The following steps are a simple way to start Windows Store app in AHK script:

  1. Create a folder, e.g. D:\WinStoreAppLinks
  2. Drag and drop a Windows Store app, e.g. OneNote (mobile), by mouse in All App List to D:\WinStoreAppLinks (through File Explorer). It will create a link there, OneNote. You can rename it as you want.
  3. The app can be run in AutoHotKey scripts (or Command Prompt), by e.g.:

Run, D:\WinStoreAppLinks\OneNote

Meng-Yuan Huang
  • 1,943
  • 3
  • 19
  • 23
26
Run shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App

Check shell:AppsFolder for full app names list

ZashWarminder
  • 261
  • 3
  • 2
  • 2
    It may be noteworthy that the part `_8wekyb3d8bbwe!App`, despite its random appearance, is always the exact same string, for every app on every Windows 10 installation. – malamut Sep 14 '21 at 14:56
  • Any other tips for getting the shell ID for the app? In the shortcut the path is appearing like `123456X.AppName_xxxxx!Z…` and the rest is cut off, so even Windows Spy won't allow copying of the entire string. The shortcut dialog is read-only and it's impossible to scroll the text. – Garret Wilson Aug 13 '22 at 17:12
  • 1
    It turns out (https://superuser.com/a/1685558) that the suffix is a `PublisherId`. If you run `Get-AppxPackage *` you can find it for the app, and even better, get the `PackageFamilyName` which is the entire string, minus the `!App` (See also the `PackageFullName`, which may or may not be relevant.) Unfortunately appending `!App` doesn't work for this particular app, and when I tried to run the actual executable I found via the `InstalllLocation` value, I get AccessDenied in AutoHotKey v2. – Garret Wilson Aug 13 '22 at 17:28
6

Here is a more verbose answer that worked for me:

  1. In an Explorer window navigate to shell:AppsFolder. This is a directory with all your Windows apps
  2. Find the app you want to launch (in my case Windows Terminal), right click it, and select Create Shortcut
  3. Accept the prompt to create this shortcut on your desktop
  4. Put this shortcut somewhere other than your desktop (e.g. C:\Shortcuts). Rename if desired
  5. Add this to your AHK script:

    Run, "C:\Shortcuts\Windows Terminal"
    

Then simple reload your AHK script. Enjoy

Damien
  • 624
  • 7
  • 25
2

This autohotkey script https://github.com/JuanmaMenendez/AutoHotkey-script-Open-Show-Apps works perfectly with any kind of app.

In the specific case of Windows Store Apps, read the section Find AppUserModelID and use the Utility Function c)

Juanma Menendez
  • 17,253
  • 7
  • 59
  • 56
1

Some of the other answers have the right idea, but are vague about which specific values to use or where to find them. Other answers have breaking typos. So here is an explanation of what you truly need, without requiring any additional shortcuts.

The Windows Store apps are in the Apps Folder, which you can see by entering shell:AppsFolder in the Win+R run window. The location identifier for the app is in the form: shell:AppsFolder\<PackageFamilyName>!<Name.id>, where <PackageFamilyName> and <Name.id> are placeholders. You'll need to replace those placeholders with the values for your application. For example, the location string for WhatsApp is shell:AppsFolder\5319275A.WhatsAppDesktop_cv1g1gvanyjgm!WhatsAppDesktop.

To discover the values for your application, go into PowerShell and look through the output of Get-AppxPackage to find the application you want. You can probably find it using: Get-AppxPackage -Name "*<AppName>*", substituting your own <AppName>. (Don't forget the asterisk wildcard.) The following will find WhatsApp, for example:

Get-AppxPackage -Name "*WhatsApp*"

If you still can't find it, enter the following in PowerShell and hit the spacebar to page through the output:

Get-AppxPackage * | more

Finally once you've formed the full application location identifier, use it in AutoHotkey like this:

Run "explorer.exe shell:AppsFolder\5319275A.WhatsAppDesktop_cv1g1gvanyjgm!WhatsAppDesktop"

Note that this uses the AutoHotkey v2 syntax.

midrare
  • 2,371
  • 28
  • 48
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
0

Tested on 27.10.2020 (and works)

  • If you know turkish, check this site
  • You can use this powershell script to find the command of store apps
$appName = Read-Host "App name"
$installedapps = get-AppxPackage
foreach ($app in $installedapps)
{
    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
    {
        
        $line = $app.Name + " = " + $app.packagefamilyname + "!" + $id
        if ($line.IndexOf($appName, [System.StringComparison]::CurrentCultureIgnoreCase) -ge 0) {
            echo "shell:appsFolder\$app.packagefamilyname!$id" 
        }
    }
}
  • To use it, first copy this script to notepad and select all recopy and paste to powershell console
  • Example output for WhatsApp:
shell:appsFolder\5319275A.WhatsAppDesktop_2.2041.7.0_x64__cv1g1gvanyjgm.packagefamilyname!WhatsAppDesktop
  • Finally copy these command and use in AHK like
Run explorer.exe "shell:appsFolder\5319275A.WhatsAppDesktop_2.2041.7.0_x64__cv1g1gvanyjgm.packagefamilyname!WhatsAppDesktop"

We need to copy to notepad to avoid powershell end of line issue (official bug) that makes line reserved

yivi
  • 42,438
  • 18
  • 116
  • 138
yEmreAk.com
  • 3,278
  • 2
  • 18
  • 37
  • 1
    Will the link change when WhatsApp updates to another version? – Garret Wilson Aug 13 '22 at 17:44
  • Do you have a typo in the line `shell:appsFolder\5319275A.WhatsAppDesktop_2.2041.7.0_x64__cv1g1gvanyjgm.packagefamilyname!WhatsAppDesktop` ? The `.packagefamilyname` shouldn't be there, should it? (I haven't run the script, but I'm reading it and I don't think the output would include `.packagefamilyname`.) – Garret Wilson Aug 13 '22 at 17:57
  • `Run explorer.exe "shell:appsFolder\5319275A.WhatsAppDesktop_2.2041.7.0_x64__cv1g1gvanyjgm.packagefamilyname!WhatsAppDesktop"` doesn't seem to work on AutoHotkey v2. You need to put everything being run in quotes. Even then, it just opens Explorer. Even added escaped quotes doesn't seem to work; it still just opens Explorer. – Garret Wilson Aug 13 '22 at 17:58
  • 1
    Bingo, I found the problem. Not only is there a typo where `.PackageFamilyName` should not be present, in addition you actually showed the `PackageFullName` value and not the `PackageFamilyName` value. (I'm guessing you didn't actually run the script. I haven't run it either, but I can see the values via `Get-AppxPackage`.) So the final command should be `Run "explorer.exe shell:appsFolder\5319275A.WhatsAppDesktop_cv1g1gvanyjgm!WhatsAppDesktop"` (placing quotes around the entire command to make it compatible with AutoHotkeys v2). – Garret Wilson Aug 13 '22 at 18:08
  • I already opened a bounty, so fix the typos and add information on alternatively running `Get-AppxPackage` manually, and I'll assign this answer the bounty because it was the closest. Otherwise I'll create my own answer. – Garret Wilson Aug 13 '22 at 18:09
0

I just used my desktop shortcut (I couldn't find my system shortcut)

run C:\Users\YourUserName\Desktop\Minecraft Launcher.lnk
SP4CEBAR
  • 1
  • 2
  • Instead of simply providing the answer directly, try writing a detailed comment that explains the solution, as long as the explanation is not too lengthy. @SP4CEBAR – DSDmark Dec 20 '22 at 05:19
0

These are the right steps that work for me.

Get the app name. There are two ways:

Press Win+R keys, paste %userprofile%\AppData\Local\Packages, press Enter. enter image description here

It should take you to Packages folder. Search the app name, then press F2, copy the folder name. enter image description here

Sometimes the app name at the title bar you see when using it might be different with the folder name in. For example, Phone Link is the name which you can see at title bar, but its actual name is YourPhone. enter image description here

In that case, we could use below method: Open PowerShell, enter Get-AppxPackage -Name "*app name*". For example enter image description here

Tthe PackageFamilyName is what we are looking for.

Now combine the app name with shell:AppsFolder\app name!app. Use the example above, we can get shell:AppsFolder\Microsoft.YourPhone_8wekyb3d8bbwe!app

You can validate it in PowerShell by start shell:AppsFolder\Microsoft.YourPhone_8wekyb3d8bbwe!app. See if that will launch the app.

Then in your AutoHotkey script, you can do Run shell:AppsFolder\Microsoft.YourPhone_8wekyb3d8bbwe!app

Arst
  • 3,098
  • 1
  • 35
  • 42
-1

I noticed that I could launch an app with the Run command by typing its name. So for example, to launch a Windows Store app with spaces in its name, you could try something like:

Run, Files UWP - Preview

... where "Files UWP - Preview" could be any app's full name, as it is shown in the Start menu.

An advantage to this solution is that it doesn't rely on a shortcut that could potentially get deleted.

Dylan Kinnett
  • 241
  • 3
  • 15
  • 1
    Didn't work with Microsoft To Do. Also you should remove "#e::" from your answer as that is a different concept than just running an app, that is also assigning a hot key – Jonathan Sep 18 '20 at 18:40