Launch powershell script from UWP app with FullTrustProcessLauncher class

不羁的心 提交于 2019-12-03 21:15:55

问题


Is there a way to launch powershell script from my UWP app ?

I have read that we have to use the FullTrustProcessLauncher class but I don't understand how to use/implement it.

Do you have any idea ?


回答1:


Docs: https://docs.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher

Samples: https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/AppServiceBridgeSample

https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/JourneyAcrossTheBridge/DesktopBridgeDemo%20-%20Step4/MyUWPApp

https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/SQLServer

In a nutshell, here is what you need to do:

1) add reference to the Desktop Extension SDK

2) declare the windows.FullTrustProcess extension in your manifest

3) (optional) declare an app service for communicating between your UWP and the fulltrust process

4) include a Win32 EXE in your package that will get launched from the FullTrustProcessLauncher API

5) that Win32 EXE can now invoke your powershell, etc.



来源:https://stackoverflow.com/questions/44157327/launch-powershell-script-from-uwp-app-with-fulltrustprocesslauncher-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!