The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @mmeeuw: Thierry Baudet over de “lange arm van Erdogan” 2016 en Thierry Baudet over de lange arm van Poetin in 2022… 1 hour ago
    • RT @VogelvrijeHArts: Van alle patiënten die de Praktijkondersteuner GGZ (POH-GGZ) in de huisartspraktijk ziet, heeft slechts 30% een psychi… 1 hour ago
    • RT @IntoTheShitter: West Texas storm chaser Laura Rowe captured the picture of a lifetime, fantastic shot of a mature supercell thunderstor… 1 hour ago
    • @helpdeskert Afwisselend pielen op mijn telefoon en proberen te slapen. Lukt soms. 1 hour ago
    • RT @locuta: Italië zelf moet die troep gewoon niet denk RT @NBCNews: Domino's closes its last branch in Italy, citing increased competiti… 4 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,856 other followers

Posts Tagged ‘comparison operators’

PowerShell conditional and logical operators (via: PowerShell Pro!)

Posted by jpluimers on 2014/04/03

Switching between many different languages, I tend to forget the exact names and symbols of the PowerShell operators.

Most of the ones I use have to do with comparison and logic, o here they are:

Most used comparison operators

Operator Description
-eq Equal to
-lt Less than
-gt Greater than
-ge Greater than or Eqaul to
-le Less than or equal to
-ne Not equal to

Logical operators

Operator Description
-not Not
! Not
-and And
-or Or

I find it funny that you have ! and -not, but not -!. Oh well (:

Talking about logicals: PowerShell can coerce a couple of values to $false, but I’m ambivalent to use that: it does shorten code, but is very PowerShell specific.

Before I forget: an operator that is undervalued, is the -f operator that does formatting.

It uses the standard .NET formatting strings, so that is an easy way to put your .NET knowledge to use. Some further reading on the -f operator:


via: Conditional Logic | PowerShell Pro! :: PowerShell Pro!.

Posted in CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Tagged: , , | Leave a Comment »

%d bloggers like this: