Windows – How to run a Metro-Application from the command-line in Windows 8

command linewindows 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?

Best Answer

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.