What is [cmdletbinding()] and how does it work?

后端 未结 3 1099
慢半拍i
慢半拍i 2020-12-11 00:14

According to get-help about_Functions_CmdletBindingAttribute

The CmdletBinding attribute is an attribute of functions that makes them operate like co

3条回答
  •  一生所求
    2020-12-11 01:04

    CmdletBinding, Parameter etc. are special attribute classes that scripters can use to define PowerShell's behavior, e.g. make a function an Advanced function with Cmdlet capabilites.

    When you call them via e.g. [CmdletBinding()] you initialize a new instance of the class.

    Read more about the CmdletBindingAttribute class at: MSDN

    Read more about the ParameterAttribute class at: MSDN

    More about Attribute classes here and here

提交回复
热议问题