问题
I have a program where i want to have the ability to launch a local application (for example Spotify) from my UWP App. I have searched the web for a solution as (Process.Start()) doesn't work. As i have understood the UWP applications is kind of sandboxed for saftey and stability reasons. But is there a (simpel) way to work around this.
I only want the ability to start and close a program inside my own frame/Window. No need to interact/send/recive data between my applications and the external program
回答1:
I have a program where i want to have the ability to launch a local application (for example Spotify) from my UWP App.
You can utilize Windows.System.ProcessLauncher
API.
Here is a sample about how to launch an external process (exe) from a Universal Windows Platform (UWP) app you can reference.
Make sure add systemManagement capabiity.
For more information reference ProcessLauncher.
回答2:
That is not possible with all apps. Some desktop apps handle protocol launches and that can be a way of launching another app. Spotify actually has a protocol registered so you could do this to launch it:
await Launcher.LaunchUriAsync(new Uri("spotify:"));
来源:https://stackoverflow.com/questions/44835014/run-external-exe-from-uwp-app-workaround-sandboxed-mode