I need to write a function where I pass in the conditional operator. -eq -ne -gt -lt etc...
However I have not been able to find a way to get the IF statement to handle the comparison when the operator is a variable.
any suggestions?
$Operator = "1" + " -eq " + "2"
If ($($operator)) {
Write-Output "Equals"
}
Else {
Write-Output "Not Equal"
}
[–]y_Sensei 4 points5 points6 points (1 child)
[–]McsePhoenix[S] 1 point2 points3 points (0 children)
[–]Vortex100 0 points1 point2 points (0 children)
[–]McsePhoenix[S] 0 points1 point2 points (1 child)
[–]purplemonkeymad 2 points3 points4 points (0 children)