Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's Eval Function

Windows PowerShell

Definition: Evaluates an expression and returns the result.


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:


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft