How do I run a Metro-Application from the command-line in Windows 8?
I'm developing an automation system and one of it's features is running applications from the command line(I mean, automatically without human intervation).
On Windows 7 I could run everything I want from a command-line call, there is some similar way to do the same with Windows 8 with also the Metro-apps installed on it?
Solution 1:
Yeah! I found a way...
Based on this source code("Open a Metro Style App from Desktop App"), I realized that I could call the metro apps just as we usually run manually. I mean, if you press Ctrl + Esc and go to metro's screen, you could just type the name of the metro app, such as "store" for example, press Enter and that's it, the metro app is running. Based on this I created a very simple VBScript to do exactly these steps automatically:
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.SendKeys "^{ESC}"
WScript.Sleep 1000
objShell.SendKeys WScript.Arguments.Item(0)
WScript.Sleep 1000
objShell.SendKeys "{ENTER}"
Save this as "metro.vbs" and call it from the command-line with the name of the metro app on first argument:
metro.vbs store
That is it, very simple and optimized way.
PS: All credits gave to AlKhuzaei, the Codeplex site user who created the related code. Thank you.
Solution 2:
The following blog post and supporting code show you how to do this with IApplicationActivationManager in PowerShell.
Get a list of metro apps and launch them in Windows 8 using PowerShell « Tome's Land of IT
Fortunately, I was able to find some code on Stack Overflow that showed how to use this in C# (the post also listed the registry information I will describe in this article). After some tweaking the code and the Add-Type syntax, I was able to expose the function I needed into PowerShell. After that it was only a matter of wrapping the function into something that resembles PowerShell.
The code can be found on poshcode.
Solution 3:
I just figured out another way to do it and wrote up a quick article on it at http://www.itsjustwhatever.com/2012/10/28/launch-windows-8-metro-apps-from-a-desktop-shortcut-or-command-line/
The short version: create a shortcut that points to bingnews:// You can see if it does what you want. If so there is more instruction to get the names on the website.