Open UWP apps from the command line on Windows 10

I was looking for a way to open, from the command line, Windows 10 UWP apps.

I am referring to Windows 10 UWP apps that are downloaded from the store.

While the source code for most of the Microsoft Windows 10 UWP apps can be downloaded and compiled on my system, creating an .EXE to run the UWP apps, I want to run the app as installed from the Windows Store.

I've created a test .btm, which allows the selection of a few UWP apps, and then executes the UWP app from the command line.

Reference the Microsoft Document Launch an app with a URI for details.

Joe
Code:
@setlocal
@echo off
::
:: Open UWP apps from the command line on Windows 10
::
:: URI - Uniform Resource Identifier
:: UWP - Universal Windows Platform
::
text > clip:
Alarm_Clocks
Calculator
Edge
Mail_To
Maps
Store
Terminal
To_Do's
Twitter
Weather
Get-AppxPackage
endtext

set results=%@select[clip:,1,1,20,80,Select a file from the list]

switch %results
case Alarm_Clocks
  start ms-clock:
  ::explorer.exe shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
case Calculator
  start ms-calculator:
  ::explorer.exe shell:AppsFolder\Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
case Edge
  start microsoft-edge:
case Mail_To
  start mailto:
case Maps
  explorer.exe shell:AppsFolder\Microsoft.WindowsMaps_8wekyb3d8bbwe!App
case Store
  start ms-windows-store:
case Terminal
  explorer.exe shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App
case To_Do's
  explorer.exe shell:AppsFolder\Microsoft.Todos_8wekyb3d8bbwe!App
case Twitter
  start twitter:
case Weather
  start bingweather:
case Get-AppxPackage
  ::
  :: Gets a list of the Microsoft app packages that are installed in a user profile.
  ::
  pshell /s "(Get-AppxPackage -Name Microsoft.*).PackageFamilyName" | *view
  ::
  :: Ref. https://docs.microsoft.com/en-us/powershell/module/appx/get-appxpackage?view=win10-ps
  ::
default
  echo No selection made.
endswitch
endlocal
 

samintz

Scott Mintz
May 20, 2008
1,421
13
Solon, OH, USA
Alternatively, you can create a shortcut and run the shortcut. I have a .LNK file to start MS Terminal for example. And I can start it by running the LNK file.
 
Indeed @samintz, that is an easier method.

I note that the shortcut does not provide alot of info;
Code:
c:\users\joe caverly\desktop>shortcut "Windows Terminal - Shortcut.lnk"
Command=
Arguments=
Directory=
Description=
Link=Windows Terminal - Shortcut.lnk
Icon=
Offset=0
Mode=1
Hotkey=
...yet in the Shortcut Properties dialog, it shows the target, but it cannot be copied;

1594306550447.png


Non-UWP Apps provide more info;
Code:
c:\users\joe caverly\desktop>shortcut "TCC 25.lnk"
Command=C:\Program Files\JPSoft\TCMD25\tcc.exe
Arguments=
Directory=C:\Program Files\JPSoft\TCMD25
Description=
Link=TCC 25.lnk
Icon=
Offset=0
Mode=1
Hotkey=Ctrl-Alt-T
Joe
 
May 20, 2008
10,621
81
Syracuse, NY, USA
Interesting! How did you make the shortcut. I have

Code:
v:\> which /a wt
wt is an external : C:\Users\vefatica\AppData\Local\Microsoft\WindowsApps\wt.EXE
I copied that file in explorer and pasted a shortcut ... giving

1594311365905.png


I can copy the target of the shortcut. When TCC executes C:\Users\vefatica\AppData\Local\Microsoft\WindowsApps\wt.EXE it waits (it shouldn't). When TCC executes the shortcut it doesn't wait. I have yet to see what C:\Users\vefatica\AppData\Local\Microsoft\WindowsApps\wt.EXE actually points to.
 
May 20, 2008
10,621
81
Syracuse, NY, USA
You can also

Code:
start shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App
Joe, where/how did you get the string "AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App"?
 
May 20, 2008
10,621
81
Syracuse, NY, USA
Hey @vefatica ,
Code:
e:\utils>which /a wt
wt is an unknown command
Was your Windows Terminal installed from the Windows Store, or did you download the source code, and compile on your system to make WT.EXE?

Joe
I installed "Microsoft.WindowsTerminal_1.0.1811.0_8wekyb3d8bbwe.msixbundle" which I think came from GitHub. I think that's equivalent to downloading it from the store. I don't have the source. C:\Users\vefatica\AppData\Local\Microsoft\WindowsApps\wt.EXE is not a real EXE. It's some kind of (undocumented?) reparse point which, I imagine, points to "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1811.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe".

From the looks of Scott's shortcut, he has the same set-up. I'd still like to know how he made the shortcut.

I think I read that building your own will avoid all the store bull@#$%. Did you build it?
 
I installed Windows Terminal from the store.

I downloaded the source from GitHub, but never built it, as I wanted to use the Store release.

When you install a UWP app from the store, you cannot launch it via the .EXE from the command line.

When you download from GitHub, you can launch a UWP app via the .EXE

I don't know why this is, but that's what I discovered with another UWP app.

The Desktop Shortcut for Windows Terminal was created when I installed Windows Terminal from the Store.

Joe
 
May 20, 2008
10,621
81
Syracuse, NY, USA
Hmmm!

I can launch WT.EXE but it's not a real app.

Code:
v:\> which /a windowsterminal
windowsterminal is an unknown command

v:\> which /a wt
wt is an external : C:\Users\vefatica\AppData\Local\Microsoft\WindowsApps\wt.EXE

c:\users\vefatica\appdata\local\microsoft\windowsapps> dir /k /m  wt*
2020-07-08  17:41               0  wt.exe
When I try to launch the real thing (even elevated) ...

Code:
v:\> "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1811.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe"
TCC: (Sys) Access is denied.
 "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1811.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe"
 
You need to remove the _1.0.1811.0_x64_ from the filename, which leaves
Code:
\Microsoft.WindowsTerminal_8wekyb3d8bbwe
Now, you can work that into;
Code:
explorer.exe shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App
which can launch the app.

Remember, it's an APP, not an EXE

Joe
 
Thread starter Similar threads Forum Replies Date
Joe Caverly T&T - Miscellaneous 1
Similar threads
Open With...