Tuesday, October 27, 2015

PowerShell Bitwise Operators

PowerShell, the fancy new-ish alternative to ye olde command prompt, does have bitwise operators, though they're a little bit difficult to guess. They're handy when using .NET methods that take flags enums as parameters. Named operators start with a hyphen and go between their operands as you would expect. All the bitwise operators are prefixed with "b", so for example "-band" is bitwise and; "-bxor" is bitwise exclusive-or. 8 -bxor 9 produces 1.

No comments:

Post a Comment