cmdlet和函数有什么区别? [英] What is the difference between a cmdlet and a function?
问题描述
模块清单:cmdlet和功能.
There are two elements in a module manifest: cmdlet and function.
cmdlet和函数有什么区别?
What is the difference between a cmdlet and a function?
推荐答案
cmdlet是用C#或其他.NET语言编写的.NET类,并包含在.dll(即二进制模块)中.在PowerShell中的脚本,脚本模块或命令行中直接指定功能.模块清单可能同时包含脚本和二进制模块,因此清单需要能够导出cmdlet和函数.尽管通常不建议从单个清单中导出同一个cmdlet和一个具有相同名称的函数,甚至是可能的.
A cmdlet is a .NET class written in C# or other .NET language and contained in a .dll (i.e. in a binary module). A function is specified directly in PowerShell in a script, script module or at the command line. A module manifest may include both script and binary modules so the manifest needs to be able to export both cmdlets and functions. It's even possible to have both a cmdlet and a function with the same name exported from a single manifest though that's generally not recommended.
这篇关于cmdlet和函数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!