I'm trying to figure out how File Explorer is able to open files in specific programs (context menu => open with), in particular installed UWP (Appx) Microsoft store apps, so that I can do this via Powershell.
See this thread for more details: How to open installed Microsoft Store apps from powershell?
In that thread we figured that you can launch installed UWP apps with arguments as follows:
Start-Process ('shell:AppsFolder\' + (Get-AppXPackage *Edge*)[-1].PackageFamilyName + '!App') -ArgumentList 'http://example.org https://wikipedia.org'
However, it seems that apps like "Photos" and "VLC" don't just open the files passed as arguments:
Start-Process ('shell:AppsFolder\' + (Get-AppXPackage *Photos*).PackageFamilyName + '!App') -ArgumentList 'C:\test\image1.png'
Start-Process ('shell:AppsFolder\' + (Get-AppXPackage *VLC*).PackageFamilyName + '!App') -ArgumentList 'C:\test\audio1.mp3'
The @mklement0 in the mentioned thread figured it's probably using COM: \HKEY_CLASSES_ROOT\jpegfile\ShellEx\{e357fccd-a995-4576-b01f-234630154e96}
and %SystemRoot%\system32\PhotoMetadataHandler.dll
I have little experience with powershell / COM / DLL, so I'm not sure how to apply this information.
Questions
Is there a general way to open any file (any extension) passed as an argument (or otherwise) in a specified UWP app with Powershell (or C# as the last resort)?
And if that's easy to do can you also suggest a way to get a list of apps that support the specified file type / extension? (the same way File Explorer's "Open with" menu does it)