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

社会主义新天地 提交于 2019-12-04 17:54:34

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/10984786/how-to-run-a-metro-app-from-powershell-on-windows-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!