开发者

Powershell - Get Variable from C# Cmdlet

开发者 https://www.devze.com 2022-12-10 21:46 出处:网络
I\'m writing开发者_JS百科 a C# Cmdlet that needs to get the value of a global script variable. How do I do it?

I'm writing开发者_JS百科 a C# Cmdlet that needs to get the value of a global script variable. How do I do it?

I noticed that the Runspace has SessionStateProxy.GetVariable method. Can I access the runspace from a C# Cmdlet?

Thanks!


If you're implementing a PSCmdlet use the this variable to access it like so:

this.SessionState.PSVariable.GetValue()
0

精彩评论

暂无评论...
验证码 换一张
取 消