PowerShell cmdlet parameter validation

后端 未结 1 1124
醉酒成梦
醉酒成梦 2021-01-19 22:01

I\'m writing a custom PowerShell cmdlet, and I would like to know which is the proper way to validate a parameter.
I thought that this could be done either in the proper

相关标签:
1条回答
  • 2021-01-19 22:32

    If possible, it's preferred that the parameters be validated by the runtime by specifying Validation Attributes on the parameter definition.

    Windows PowerShell can validate the arguments passed to cmdlet parameters in several ways. Windows PowerShell can validate the length, the range, and the pattern of the characters of the argument. It can validate the number of arguments available (the count).

    0 讨论(0)
提交回复
热议问题