Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Converting VBScript's Eval Function


Windows PowerShell


Definition: Evaluates an expression and returns the result.

Eval

OK, we’re not sure how often you need to evaluate an expression (such as a mathematical equation) and simply know whether that expression is true or false. If you do need to do this, however, you can do so simply by using the -eq comparison operator. For example, this command evaluates the expression 2 + 2 = 45 and then stores the evaluation (true or false) in the variable $a:



$a = 2 + 2 -eq 45

When you run this command and then echo back the value of $a you should get the following:



False


Return to the VBScript to Windows PowerShell home page

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.