Launching a Windows 10 App from the Command Line

I’m trying to note down things that have helped me while using Windows – to the point that I feel that my setup is geared towards me, and it sometimes, becomes a challenge when using someone else’s computer temporarily. The post is for me to remember how I did something but if it helps someone, that’s a plus!

Progressively, Windows has moved more and more applications into the Windows Store as Windows Apps. This sounds great and works like other stores in that the apps are automatically updated, available across your devices, etc. but there is a slight problem that programmers will notice when they try to interact with these apps – they don’t have a directly accessible command line!

What I mean is that something like Notepad has always been at a path like c:\Windows\System32\notepad.exe and if that is on your path (which it usually is), you could just do notepad on the command line and it would promptly launch the application. That is, however, not possible with Windows Apps – they do not have a directly accessible command line – you can’t do something like c:\apps\Whiteboard.exe or something similar – it doesn’t work.

I was keen to find how to solve this because I wanted to integrate two things that have helped me a lot through the Work from Home phase due to the COVID-19 restrictions:

The tablet has 4 buttons that can be mapped for different things and I have only ever used one of these buttons to launch the Wacom Control Panel (mostly to map the tablet area to only one of the screens) but given how many times I was launching the Whiteboard app, I thought it was sensible to map one of the buttons to the Whiteboard app. However, when I tried to do that in the Wacom Control Panel, I found the problem above – I can’t assign it since it wants to navigate to the path and there isn’t one!

A search brought me to this page: and this finally has the line that is needed:

start shell:appsFolder\[TARGET]!App

If you look at the first post there, you can see how to find the “TARGET” – it’s basically a strange looking path. The easy way is to create a shortcut on the Desktop and look at the Properties and then the shortcut tab, you should see something like this:

The TARGET for Whiteboard (on my system) is: Microsoft.Whiteboard_8wekyb3d8bbwe!Whiteboard

So, you can launch the App from the command line using: start shell:appsfolder\Microsoft.Whiteboard_8wekyb3d8bbwe!Whiteboard which is a bit difficult, of course. So, in this case, I do what I normally do – create a CMD file and throw it into a directory on my path.

So, I have created a CMD file called start_wb.cmd and put just that one line in it, saved it to a folder that is on my path and we’re good to go. Just do start_wb on the command line, and it works perfectly well.

Coming back to the problem I had with Wacom Control Panel, it’s easy now – just get it to map the button to start_wb.cmd and it’s done. There is one minor issue to keep in mind – since we launch it using a CMD script, you temporarily see a small command line window open and then quickly disappear as the Whiteboard launches. I don’t know how to handle that yet, but it doesn’t bother me too much.

A simpler way? A simpler way!

The great thing about Twitter is that you get instant feedback – someone on Twitter suggested that it might also work if we just had shortcuts to the Windows apps, and launched it using the shortcut.

So, I set about to verify that – short answer: yes, it can work but if you keep a couple of things in mind.

With Wacom Control Panel: The Wacom Control Panel will happily accept a shortcut (a Windows file with the .LNK extension) and will be able to launch it – so, it works there without any trouble at all!

From the command line: You can launch a .LNK file by providing the full path to it; or if the directory is on the path, you can type the name of the shortcut and it will work. Just one thing to keep in mind: you must provide the full name, including the “.lnk”. Unlike EXE files (or CMD, BAT, etc.), a .LNK file will not automatically be treated as an executable.

If this is the method that you end up using, you might want to rename it to something simpler so that you can remember it – especially if it has spaces in it (enclose in double quotes if there are spaces in the name).

comments powered by Disqus