标签: c# powershell cmdlets
我正在编写一个需要获取全局脚本变量值的C#Cmdlet。 我该怎么做?
我注意到Runspace有SessionStateProxy.GetVariable方法。 我可以从C#Cmdlet访问运行空间吗?
谢谢!
答案 0 :(得分:8)
如果您正在实现PSCmdlet,请使用this变量来访问它:
this
this.SessionState.PSVariable.GetValue()