Running powershell scripts from within a .NET windows app

后端 未结 1 625
悲&欢浪女
悲&欢浪女 2021-01-24 16:29

I\'m needing to run scripts from within a vb.net windows app.

I\'ve got the scripts running in the background fine;

 Using MyRunSpace As Runspace = Runsp         


        
相关标签:
1条回答
  • 2021-01-24 16:58

    There is a distinction between the PowerShell engine and its host. What you're wanting is to run the engine within your application but then fire up a separate host (which also is hosting the PowerShell engine) to handle prompts. You might want to look into modifying your application to act as a host itself. You could then react to prompts (read-host) and pop dialog boxes or whatever. Take a look at this relevant PowerShell namespace. Also check out this blog post on creating a simple PSHost.

    0 讨论(0)
提交回复
热议问题