开发者

Is it possible to handle switch parameters with Add-Member methods?

开发者 https://www.devze.com 2023-01-13 16:13 出处:网络
When adding a method to a PSObject using Add-Member is it possible to use [swi开发者_开发知识库tch] parameters?

When adding a method to a PSObject using Add-Member is it possible to use [swi开发者_开发知识库tch] parameters?

If so how does the syntax work when calling these methods?


Only commands (functions, cmdlets) can have switches that work in the way you'd expect. If you assign a scriptblock as a method, any parameters that are declared as [switch] will be treated as if they are [bool], accepting only $true or $false.

0

精彩评论

暂无评论...
验证码 换一张
取 消