将cmdlet输出作为参数传递. [英] passing cmdlet output as a parameter..

查看:52
本文介绍了将cmdlet输出作为参数传递.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..
我对所要的内容有点害羞,但是我没有使用PowerShell语言的经验..

我正在使用C#..开发一个项目,在这里我需要读取"1 cmdlet"的输出并将此输出作为参数传递给另一个cmdlet ...

我知道使用C#易于实现,但是我对整个"cmdlet"都感到困惑".而且我也不知道该怎么办.

hey guys..
I am little bit shy of what am I asking for, but I have no experience in PowerShell language..

I am working on a project using C#.. where I need to read an output of "1 cmdlet" and pass this output as a parameter to another cmdlet...

I know it''s easy to do using C#, but I am confuse about the whole "cmdlet" thin''.. and I don''t know what to do..
any ideas how to do that ???

推荐答案

使用 AddCommand [ http://stackoverflow.com/questions/527513 /execute-powershell-script-from-c-sharp-with-commandline-arguments [
Use the PowerShell class[^]? Use the AddCommand[^] method to add cmdlets to the processing pipeline.

See also: http://stackoverflow.com/questions/527513/execute-powershell-script-from-c-sharp-with-commandline-arguments[^], where you can see an other approach that uses runspace pipeline.


这篇关于将cmdlet输出作为参数传递.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆