November 6th, 2015

PowerTip: Find if Variable Is Array

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to find if a variable is an array.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find if a variable contains an array?

Hey, Scripting Guy! Answer Use the –is operator, and test to see if it is a type of [array], for example:

$a = 1,2,4,5,6,7

$a -is [array]

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.