共用方式為


Tip o' the Week 445 – Finding Modern App names

As detailed in ToW #443, clip_image002there are ways of running Modern Windows apps from a script, command line or maybe just from the WindowsKey+R Run prompt – so you don’t need to use the mouse or your finger to activate them.

If you’re looking for the shortcut name for your favourite app, there’s a somewhat lengthy process to find out what it is, but at least you only need to do it once…

clip_image004

Try the following:

  • Fire up PowerShell (press Start, type powershell then make sure you don’t go for the ISE unless you want to do some script authoring and debugging. In other words, if you don’t know why you would want to run PowerShell ISE, then just stick with PowerShell…)
  • From the PowerShell console, run get-appxpackage > $env:userprofile\apps.txt – this will grab the details of every installed modern app in turn, and pipe all of the text to a file
  • Press WindowsKey+R and run apps.txt to launch the file, and you’ll see an almost impenetrable wall of text (thousands of lines – in Notepad, go to the View menu and enable the Status Bar then press CTRL+END to jump to the very bottom, if you want to see just how many lines…)

clip_image006

  • clip_image008Now, you might be able to figure out from the Name line in the text, which app the following details pertain to, but it’s not always obvious – take the Mail app, for example … if you have it pinned to the Start menu and then drag/drop it onto your desktop to create a shortcut, you can see the target (which is the same as the PackageFamilyName attribute in the text file) is a bit more opaque… 
  • There are all sorts of ways you could dig around in the file system and/or the registry to find out what the shortcut name is to launch your chosen app, but perhaps the quickest is to copy/paste this text into a PowerShell console and hit enter:foreach ($p in $(get-appxpackage)) { foreach ($n in (Get-AppxPackageManifest $p).package.applications.application.extensions.extension.protocol.name) { $p.packagefullname + "`t `t `t -=- " + $n } } clip_image010
  • This will display a list of all the packages and the “protocols” that each can support, in other words the direct commands you can run to invoke them (if you run that command and stick a “:” on the end) . Some will be pretty useless, but others can be handy – like onenote-cmd: which launches the Modern OneNote without the annoying prompt you get if you just try onenote:
  • If you want to create a traditional (eg Desktop) shortcut to one of your fave apps, just right-click, New, Shortcut and enter the command, give it a name, and Robert’s your father’s brother.

clip_image011clip_image013

clip_image015clip_image017

  • You could use a variant of this approach to automatically launch Modern apps when Windows itself starts – from WindowsKey+R, enter shell:startup and drop (or create) your shortcut in there.