Function Parameter that is only $true if specified - similar to -verbose

Hello,

I have created a function where I would like to optionally specify a parameter called -update that is $true (or is not $null) only when specified, but I don’t want to call it as -update $true

Similar to -verbose in that specifying $true is not required, as it is inferred to be $true / not $null

Is this possible?

Many Thanks,
Pin

Pin Pin Poola.
Welcome to the forum. :wave:t4:

Yes, it is. Those parameters are called switch parameters. Here you can read more about:

1 Like

Hello @Olaf

Thank you for the kind welcome and for the information on switch parameters.

I really appreciate it.

Thx
Pin.