Reputation: 1069
If I define the command line parameters as such:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False)]
[string[]$myString
)
How do I evaluate if $myString
is present and create a variable to represent yes or no?
Many thanks.
Upvotes: 0
Views: 304
Reputation: 518
You could simply do a null check on the variable:
if ($myString) {
'set true variable'
} else {
'set false variable'
}
Upvotes: 2