Trigging the Mail app with Powershell

Hi,

I have a Powershell script that I run at the start of day to trigger my most used applications.I’ve been using the following command:

start “shell:AppsFolder$(Get-StartApps “Your Phone” | select -ExpandProperty AppId)”

Which launches the “Your Phone” app without issue. I have tried to do the same with the Windows 10 email app:

start “shell:AppsFolder$(Get-StartApps “Mail” | select -ExpandProperty AppId)”

But I get an error

start : This command cannot be run due to the error: The system cannot find the file specified.

At line:1 char:1

  • start "shell:AppsFolder$(Get-StartApps “Mail” | select -ExpandProper …

  • 
      + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException 
    
      + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    
    

So then I tried:

start “shell:AppsFolder$(Get-StartApps “Mail and Calendar” | select -ExpandProperty AppId)”

No error, but it only opened the application folder.

I then used:

Get-AppxPackage -AllUsers | Select Name, PackageFullName

But this didn’t show a Mail app. I believe that the Mail app is part of “microsoft.windowscommunicationsapps” but running:

start “shell:AppsFolder$(Get-StartApps “microsoft.windowscommunicationsapps” | select -ExpandProperty AppId)”

Just opens the Application folder.

Any ideas what the correct command should be?

Thanks

Steve

Steve,
Welcome to the forum.

I’d start with listing ALL the possible apps and looking for the one needed with

Get-StartApps | Sort-Object -Property Name

Regardless of that - please when you post code, error messages, console output or sample data format it as code using the “preformatted text” button ( </> ).

Thanks in advance.

Hi Olaf,

Thanks for taking the time to reply. Using your command I found Mail listed as:
Mail microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.mail

So in theory this command should work?
start “shell:AppsFolder$(Get-StartApps “Mail” | select -ExpandProperty AppId)”
Or am I missing something?

Sorry about the bad formatting, I think that I got it right this time.

To be honest … I don’t know. I’m not using the “Your Phone” app and it does not work with any of the apps available on my computer.

I’d rather use the complete path of the desired app and run it this way. :wink:

Almost. Simply click on the “preformatted text” button ( </> ) first and then paste the code in the position that is shown to you. :wink:

This is a curiosity question. Does this app not live by the rules of Windows 10 whereby any app open when you shut down Windows is automatically loaded when you restart?

I personally dont like this behavior and so do a fair number of users in a google search. Again, I am just curious why you have to use a script to get this done. Thanks.

I have not found a way to use the complete path of a Windows store app, they don’t reside in the usual folders.

Hi Tony,

I’m not trying to trigger this group of apps to open every time that I startup. Instead I have a single button in the Start menu that triggers all of my messaging apps when required.

It was actually a little project to get me using Powershell, but now it has me scratching my head!

I’m not using Windows Store Apps at all but I googled it for you and found this:

https://www.tenforums.com/software-apps/57000-method-open-any-windows-10-apps-command-line.html

and this:

Hi,

Very kind of you! That worked a treat. Thank you.