Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an "and" statement to match more than 1 value

Tags:

powershell

I got this part of a script

| Where {$_.property = statement}

I would like to add another value so that it has to match both values, so the command is going to work kinda like this

| Where {$_.property -eq statement} &  {$_.anotherproperty -eq anotherstatement}

anyone who can help?

like image 341
Casper Avatar asked Dec 14 '11 09:12

Casper


People also ask

How do you create an IF THEN statement in Excel with multiple conditions?

Another way to get an Excel IF to test multiple conditions is by using an array formula. To complete an array formula correctly, press the Ctrl + Shift + Enter keys together. In Excel 365 and Excel 2021, this also works as a regular formula due to support for dynamic arrays.

Can IF statement have 2 conditions in Excel?

The multiple IF conditions in Excel are IF statements contained within another IF statement. They are used to test multiple conditions simultaneously and return distinct values. The additional IF statements can be included in the “value if true” and “value if false” arguments of a standard IF formula.


1 Answers

Logical and is done using -and in powershell:

| Where {$_.property -eq statement -and $_.anotherproperty -eq anotherstatement}
like image 53
Lee Avatar answered Nov 12 '22 04:11

Lee