I am working from the command line. Let's say my example looks like this:
Param(
[Parameter()] [string]$greeting="HelloWorld"
)
From the commandline I can do this: mygreeting
And it will output HelloWorld
Or I can do this: mygreeting -greeting="whatever"
And it will output whatever
Why can't I type this?:
mygreeting -greeting
without getting an error that the argument is missing?
In the code I want to be able to basically say:
If greeting is specified but has no value then set the value conditionally based on other things
If greeting is not specified use the default value
mygreeting -greeting ""? If you pass in a flag, I think it requires something