bradyep.com

A Vanity Website

Opening Metro / Modern / Windows Store apps from PowerShell

I like to easily launch stuff with just a few keystrokes in PowerShell, so when I did a Google search on ‘How to Launch Metro Apps from PowerShell’, I was a little surprised to see the first result tell me that doing so was not possible. After some more time spent researching however, I found out that this was not the case.

The first thing we need to find out is the name of the Metro application - and just a little aside here, I know they are technically called ‘Windows Store’ apps, but for the sake of brevity I’ll be calling them ‘Metro’ apps. Windows 8 applications are basically launched through their protocols, so to find the protocol we are interested in: press the Windows Key and type in ‘Default Programs’ and open up the first thing it returns. Now click on ‘Associate a file type or protocol with a specific program and scroll to the bottom of the list to see the ‘Protocols’. Find the app you are interested in, in my case it is the Bing Weather app shown below.

Now open up Internet Explorer 10/11 and put your protocol into the location bar shown below. In my case: bingweather:///, and hit Enter. Click ‘Allow’ and make sure it takes you to the app you are interested in.

Now that we know we can open up our app, we can create a shortcut for it. Copy what you put into the location bar in IE to open up the app (in my case “bingweather:///”) and create a new shortcut for it somewhere on your computer. I used a ‘Shortcuts’ directory in my user folder. To do this just right click wherever you want the shortcut and select New -> Shortcut. Specify the location as the URL we copied from Internet Explorer and click Next to name and save it.

Now that we have our shortcut in place we can create a PowerShell alias to call on it. Open up your ‘Microsoft.PowerShell_profile.ps1’ file with the PowerShell ISE and add an alias to your new shortcut. For example I used:

Set-Alias wea "C:\Users\bradyep\Shortcuts\bingWeather.url"

Save that file and open up a new instance of PowerShell and type in your alias and, boom, your Metro app should open up right there. Don’t forget that you can use Shift + Windows Key + Left or Right to move the Metro app to different monitors as well.