Powershell Cmdlet用于在.ps1文件中调用脚本块或函数 [英] Powershell Cmdlet used to invoke a Script Block or function in a .ps1 file
问题描述
假设我有一个.ps1文件,其中包含一些PowerShell脚本函数。我需要从C#cmdlet调用特定函数。
Say I have a .ps1 file with some PowerShell script functions in them. I need to invoke a particular function from a C# cmdlet.
此链接(https://msdn.microsoft.com/en-us/library/ms714819(v=vs。 85).aspx)说如何调用脚本块,但它没有提供完整的示例。它不清楚调用中的参数是什么?
This link ( https://msdn.microsoft.com/en-us/library/ms714819(v=vs.85).aspx ) says how to invoke a script block but it does not provide a complete sample. Its not clear what the parameters are in the call
script.Invoke(line,
simpleMatch,
caseSensitive
);
是否有完整的示例可用于显示如何调用函数一个Powershell脚本文件?
Is there a complete example available which shows how to call a function in a Powershell script file?
在这种情况下是否必须有脚本块,或者在给定文件路径的情况下是否可以直接调用函数?
Is it mandatory to have a script block in such a case or can a function be invoked directly given a file path?
TIA,
Jy
推荐答案
Hello Jy_13 ,
Hello Jy_13,
我从博客下面开始 Powershell命令。
您可以参考以下链接。
最好的问候,
Neil Hu
这篇关于Powershell Cmdlet用于在.ps1文件中调用脚本块或函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!