Diogo
Diogo

Reputation: 1603

How to run a Metro-App from PowerShell on Windows 8?

Related to another question on Superuser, I'm trying to run a Metro based application from the command-line. According to a comment on my superuser question, I could maybe find an answear on a PowerShell command or script. I already tried but found anything on any internet reference about PowerShell and Windows 8...

So, there is some specific way/command to call and run a Metro-style application from a PowerShell command on Windows 8?

Upvotes: 11

Views: 8390

Answers (2)

codeulike
codeulike

Reputation: 23064

Here's a blog post by Powertoe that uses the IApplicationActivationManager way of doing it:

http://powertoe.wordpress.com/2012/11/02/get-a-list-of-metro-apps-and-launch-them-in-windows-8-using-powershell/

He provides code here http://poshcode.org/3740 that provides a Start-MetroApp commandlet for powershell.

Alternatively: I think some Metro Apps have protocol handlers, so that you can talk to them via a URI (e.g. "appname:dosomething") but I'm not sure how widely used this is.

Upvotes: 2

Jared Bienz - MSFT
Jared Bienz - MSFT

Reputation: 3550

There is no direct way to do this but there are a couple indirect ways.

vsdebuglaunchnotify, which comes with Visual Studio, can be called from PowerShell.

You could create your own exe that uses IApplicationActivationManager.

If the app is associated with any file types you could launch an associated file.

More information is covered in this thread on MSDN:

http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/8d1b0861-5903-4289-8cb8-541ddaa012fb

Upvotes: 4

Related Questions