开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜