Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
In Windows 8, is there a command-line? –  Ian Boyd Jun 6 '12 at 16:59
    
yes, just type cmd on the metro interface and execute it. –  Diogo Jun 6 '12 at 16:59
    
Are you using VS? –  soandos Jun 6 '12 at 17:07
    
VS you mean Visual Studio?? No, I'm not... –  Diogo Jun 6 '12 at 17:08
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 '12 at 17:17

3 Answers 3

up vote 9 down vote accepted

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.

share|improve this answer
    
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. –  Jim McKeeth Jun 14 '12 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 '12 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. –  Jim McKeeth Jun 14 '12 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 '12 at 18:33
    
Yeah, it is really annoying. I uninstalled the Metro version of Evernote for precisely that reason. –  Jim McKeeth Jun 14 '12 at 19:18

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.

share|improve this answer

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.

share|improve this answer
    
Welcome to Super User, Tome! We'd like answers to be self-contained, thus not relying on external resources too much. I quoted the most relevant parts of your blog post, but you're free to edit in much more, also with regards to solving the exact problem of the OP. –  slhck Nov 3 '12 at 6:59
    
Very cool information, here! –  Ben Richards Nov 3 '12 at 7:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.