Commonly Used Comparison Operators in Windows PowerShell 2

Part of the Windows PowerShell 2 For Dummies Cheat Sheet

As you use PowerShell 2 to help automate your Windows operating system, you use comparison operators to compare one value with another. Some of PowerShell 2's most common comparison operators are listed in the following table:

Operator Description
-lt less than
-le Less than or equal to
-gt Greater than
-ge Greater than or equal to
-eq Equal to
-ne Not equal to
-like Like (uses wildcard for pattern matching)
-match A match using Regular Expressions
-contains Used to see if a collection or group of items contains a given item
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.