20

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?

6
  • In Windows 8, is there a command-line?
    – Ian Boyd
    Jun 6, 2012 at 16:59
  • 2
    yes, just type cmd on the metro interface and execute it.
    – Diogo
    Jun 6, 2012 at 16:59
  • Are you using VS?
    – soandos
    Jun 6, 2012 at 17:07
  • 2
    FWIW, you may want to focus on Powershell instead. The AppX package includes several cmdlets for managing Metro apps (see Get-Help Appx for details), though I couldn't find anything for running them at the moment.
    – Indrek
    Jun 6, 2012 at 17:17
  • 1
    From my knowledge, you cannot run Metro apps from the command line. I hope somebody knows some hack/solutions. Jun 12, 2012 at 19:01

4 Answers 4

12

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.

7
  • Ah, I was wondering the same thing. Interesting solution. The only problem is if you have two programs with the same name, like both the Metro and desktop versions of Evernote installed. Which gets launched with the above?? There should be another way since Visual Studio can launch the application you are developing. Jun 14, 2012 at 18:27
  • I think that because the ctrl+esc, it will open only the metro app... It is something that would woth the test.
    – Diogo
    Jun 14, 2012 at 18:30
  • Nope, just tried it. [Ctrl]+[Esc] is the same as [Win], and both just show the Start Menu, which is allows launching any program there - Metro and Desktop alike. Jun 14, 2012 at 18:32
  • So, what does Windows 8 does when two apps metro and desk have the same name??? It become duplicated on metro interface?
    – Diogo
    Jun 14, 2012 at 18:33
  • Yeah, it is really annoying. I uninstalled the Metro version of Evernote for precisely that reason. Jun 14, 2012 at 19:18
6

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.

0
5

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.

1

I found a way to run Windows Universal apps which downloaded via Windows Store or preinstalled. Each Windows 8/10 Universal app has an AUMID which stands for 'Application User Model ID'.

PowerShell Command to get all AUMID:

get-StartApps

Output:

PS C:\> get-StartApps

Name                      AppID
----                      -----
Skype                     Microsoft.SkypeApp_kzf8qxf38zg5c!App
Snip & Sketch             Microsoft.ScreenSketch_8wekyb3d8bbwe!App
Mail                      microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Calendar                  microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Movies & TV               Microsoft.ZuneVideo_8wekyb3d8bbwe!Microsoft.ZuneVideo
Photos                    Microsoft.Windows.Photos_8wekyb3d8bbwe!App
Video Editor              Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry
Maps                      Microsoft.WindowsMaps_8wekyb3d8bbwe!App
Alarms & Clock            Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
Voice Recorder            Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App
Camera                    Microsoft.WindowsCamera_8wekyb3d8bbwe!App
Microsoft Store           Microsoft.WindowsStore_8wekyb3d8bbwe!App
Weather                   Microsoft.BingWeather_8wekyb3d8bbwe!App
Cortana                   Microsoft.549981C3F5F10_8wekyb3d8bbwe!App
Instagram                 Facebook.InstagramBeta_8xx8rvfyw5nnt!Instagram
...

So now, you can start any universal app via its AUMID like this:

explorer shell:appsfolder\[AUMID]

For example, if you want to execute Skype:

explorer shell:appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .