True/False (Boolean) Values in PowerShell

This one keeps tripping me up. The following value

FALSE

is actually evaluated as boolean TRUE in PowerShell if you type it in literally. PowerShell is a bit like JavaScript in how it handles true and false, there is true-ish and false-ish.

The easiest thing to remember is that

$TRUE

is true and

$FALSE

is false.

The Windows PowerShell Blog has a good indepth article on boolean values. Searching through Google for this answer tends to lend results that more deal with boolean operators and functions than the literal values themselves.

About Mike

I'm a software engineer. Look into the about page for more information about me.
Tagged . Bookmark the permalink.

Comments are closed.