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.
You could simply do a null check on the variable:
if ($myString) {
'set true variable'
} else {
'set false variable'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.