#Is there a Mandatory action preference?

6 messages · Page 1 of 1 (latest)

narrow yew
#

By defaulty pwsh prompts for input when a mandatory parameter was not given a value, can I made it error instead?

ivory pollen
#

you can launch pwsh with -NonInteractive.

pwsh -NoProfile -NonInteractive -Command 'Get-Content'

^ throws

narrow yew
#

thanks!

#

well that disabled shouldprocess too unfortunately

ivory pollen
#

yeah ofc, it disables all interactive prompts

sturdy furnace
#

Instead of making it mandatory, you could give it a default value of $(throw 'Your message here')