about_Comparison_Operators.help

About_Comparison_Ope - TOPIC about_Comparison_Operators SHORT DESCRIPTION Describes the operators that compare values in Windows PowerShell LONG

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

View Full Document Right Arrow Icon
Sheet1 Page 1 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sheet1 Page 2 Description: Greater-than. Example: C:\PS> 8 -gt 6 TRUE -ge Description: Greater-than or equal to. Example: 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 (*). Example: C:\PS> "Windows PowerShell" -notlike "*shell" FALSE
Background image of page 2
Sheet1 Page 3 -match Description: Matches a string using regular expressions. When the input is scalar, it populates the
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 7

About_Comparison_Ope - TOPIC about_Comparison_Operators SHORT DESCRIPTION Describes the operators that compare values in Windows PowerShell LONG

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online