|
Guy recommends :
Find out which of your VMs are a waste of space and which VMs need more resources.
|
PowerShell 3.0 -NotIn and -InNew PowerShell 3.0 Comparators -NotIn and -InPowerShell 1.0 not only has comparison operators such as -match, -like and -contains, but also their negative counterparts such as -notContains. Here in PowerShell 3 we have two new members of the comparsion operators team: -in and -notIn. Windows PowerShell -In Topics
Example 1: Testing Numbers in a RangeIn this example we are asking PowerShell the question: 'Is 77 in the range 70 to 80?' # PowerShell -in Note 1: The key to using -in (and -notIn) is mastering the ranging dots .. between the values Example 2: PowerShell's -notInOnce you have mastered the -in comparator, you'll have no trouble with its sister command -notIn, it works in a complimentary manner in according to what logic would predict. # PowerShell -notIn The Secret to Understanding PowerShell 3's -In and -NotInThe easiest way to learn which comparator to choose for which script is to compare them! That is how I appreciated the nuances of -like and -match. In the case of -in, substitute -contains and observe the similarities and differences. For me, it all comes down to those two ranging dots, which -in loves, but -contains seems to ignore. # Windows PowerShell -contains Note 2: This makes no sense, thus abandon -contains and go back to -in. See Example 2 above
Guy Recommends: SolarWinds' Free Bulk Import Tool
|
||||
Custom Search
|
Guy Recommends: WMI Monitor and It's Free!
|
|
Author: Guy Thomas Copyright © 1999-2012 Computer Performance LTD All rights reserved. Please report a broken link, or an error to: | |