{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


about_Comparison_Operators.help - TOPIC...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
TOPIC about_Comparison_Operators SHORT DESCRIPTION Describes the operators that compare values in Windows PowerShell. LONG DESCRIPTION Comparison operators let you specify conditions for comparing values and finding values that match specified patterns. To use a comparison operator, specify the values that you want to compare together with an operator that separates these values. By default, all comparison operators are case-insensitive. To make a comparison operator case-sensitive, precede the operator name with a "c". For example, the case-sensitive version of "-eq" is "-ceq". To make the case-insensitivity explicit, precede the operator with an "i". For example, the explicitly case-insensitive version of "-eq" is "ieq". All comparison operators except the containment operators (-contains, -notcontains) and type operators (-is, -isnot) return a Boolean value when the input to the operator (the value on the left side of the operator) is a single value (a scalar). When the input is a collection of values, the containment operators and the type operators return any matching values. If there are no matches in a collection, these operators do not return anything. The containment operators and type operators always return a Boolean value. Windows PowerShell supports the following comparison operators. -eq Description: Equal to. Includes an identical value. Example: C:\PS> "abc", "def" -eq "abc" abc -ne Description: Not equal to. Includes a different value. Example: C:\PS> "abc", "def" -ne "abc" def -gt Description: Greater-than. Example: C:\PS> 8 -gt 6 True -ge Description: Greater-than or equal to. Example:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C:\PS> 8 -ge 8 True -lt Description: Less-than. Example: C:\PS> 8 -lt 6 False -le Description: Less-than or equal to. Example: C:\PS> 6 -le 8 True -like Description: Match using the wildcard character (*). Example: C:\PS> "Windows PowerShell" -like "*shell" True -notlike Description: Does not match using the wildcard character (*).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}