0

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.

1

1 Answer 1

2

You could simply do a null check on the variable:

if ($myString) {
 'set true variable' 
} else { 
 'set false variable' 
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.