[英]Connect with Powershell console to runspace embedded in my app
I'm trying to embed PS in my .NET app to make part of object model easily discoverable and have the ability to navigate it. 我试图将PS嵌入我的.NET应用程序中,以使对象模型的一部分易于发现并具有导航能力。 It is easy to create runspace, prompt user for some script as plain string, run the script in the runspace and output something to the user.
创建运行空间很容易,以纯字符串形式提示用户输入一些脚本,在运行空间中运行脚本并将某些内容输出给用户。 But in that way it lacks interactivity - user doesn't get auto-completion, IntelliSense, tooltips etc, thus he is required to issue
Get-Members
constantly just to know what he can do with given objects. 但是以这种方式,它缺乏交互性-用户不会获得自动完成功能,IntelliSense,工具提示等,因此,他需要不断发出
Get-Members
才能知道自己可以使用给定的对象做什么。
As I understand interactivity is provided by PSHost
thing. 据我了解,交互性是由
PSHost
提供的东西。 Is it possible to go without implementing it manually in the application, but rather expose embedded runspace somehow, so I can connect to it with PowerGUI for example? 是否可以不用在应用程序中手动实现它,而是以某种方式公开嵌入式运行空间,以便例如可以使用PowerGUI连接到它?
Enter-PSSession
or something alike. Enter-PSSession
之类的。
我很确定您将必须实现自己的制表符补全,就像由PowerShell Host那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.