2

I would like to automate the start-up process of a Microsoft Windows 10 Universal Windows Platform software application.

According to this question, this issue is still not feasible without resorting to a workaround.

The workaround refers to the writing of a batch file that uses the Microsoft Windows PowerShell integrated shell-scripting environment in order to start that particular software application.

However, there is no straightforward path toward that particular software application within the C:\Windows\SystemApps\ folder.

Any clues?

Update after the comments and the first two answers that have already been provided below:

The app is called as "Weather". Its long name seems to be "Microsoft MSN Bing Weather".

The answer that presents an automated solution based on the Microsoft PowerShell Integrated Shell-Scripting Environment is presented below.

A simple manual work-around is the following one:

  1. Using the Start Menu (and not the Start Screen that covers the whole desktop view as in a full-screen mode), drag-and-drop the "Weather" tile on the desktop view.

  2. Press the Windows+R keys-combination in order to pop up the "Run" dialog box.

  3. Type shell:startup and the Enter key.

  4. Copy the "Weather" shortcut from the desktop view inside the StartUp folder.

2 Answers2

1

You can invoke a UWP Application like this:

explorer.exe shell:appsFolder\<PackageFamilyName>!<PackageName>

If you run the following command in PowerShell:

Get-AppxPackage | Select-Object PackageFamilyName, Name

You'll get the PackageFamilyName and the PackageName returned. which you then can use in the command mentioned above. For example if you want to start the Windows Store:

explorer.exe shell:appsFolder\Microsoft.WindowsStore_8wekyb3d8bbwe!Microsoft.WindowsStore

You could then write your own Start-AppxPackage function (it's a mystery to me why there is no native cmdlet for this yet)

Function Start-AppxPackage {
Param(
    [parameter(ValueFromPipelineByPropertyName)]
    [string]$PackageFamilyName,
    [parameter(ValueFromPipelineByPropertyName)]
    [string]$Name
)

Process {
    $Invoke = &quot;explorer.exe shell:appsFolder\{0}!{1}&quot; -f $PackageFamilyName, $Name
    Invoke-Expression $Invoke   
}

}

and then you can simply use it like this for example:

Get-AppxPackage *photos* | Start-AppxPackage

You can also Start multiple apps at once:

Get-AppxPackage | ? {($_.Name -like '*photos*') -or ($_.Name -like '*store*')} | Start-AppxPackage

This command can then be included in a startup script or something similar

However, to be honest, this seems to be super buggy this starting shell apps via explorer. after a while it only opened the explorer on my documents instead of starting the correct shell app.

SimonS
  • 9,869
1

Windows store apps have a few quirks, but can be dealt with. Powershell refers to windows store apps as AppxPackages, but a package can have more than one app inside it, so we also need to check the AppxManifest.xml file to get more information.

First you'll need the package name, you can find it by dragging a shortcut to your desktop, then checking the properties > Targettype (you only need enough to have a unique name):

TargetType screenshot

In Powershell now, we get the package - you can find the package name by dragging a shortcut to your desktop, then checking the properties > Targettype:

$pkg = Get-AppxPackage *Communication*

Then we get the XML data of its manifest:

$manifest = [xml](get-content "$($pkg.InstallLocation)/AppxManifest.xml")

Then we get the package ID from within the XML:

$ID = $manifest.Package.Applications.Application.id

For our sanity, we check to make sure we only have one app ID:

if ($id.count -gt 1) {Write-Error "Found more than one app ID in package!: $id";break}

In my case, I have more than one, so I'll specify the ID manually:

$ID = 'microsoft.windowslive.calendar'

And finally, we launch the app:

Start-Process explorer.exe -ArgumentList "shell:appsfolder\$($pkg.PackageFamilyName)!$id"

Or as a single script:

$pkg = get-appxpackage *Calculator*
$manifest = [xml](get-content "$($pkg.InstallLocation)/AppxManifest.xml")
$id = $manifest.Package.Applications.Application.id
if ($id.count -gt 1) {Write-Error "Found more than one app ID in package!: $id";break}
Start-Process explorer.exe -ArgumentList "shell:appsfolder\$($pkg.PackageFamilyName)!$id"

Please Note: this has to run as the current logged-in user.

Cpt.Whale
  • 10,914