July 18th, 2013

PowerTip: Find Number Elements in a PowerShell Array

Doctor Scripto
Scripter

Summary: Easily find the number of elements in a Windows PowerShell array.

Hey, Scripting Guy! Question How can I find how many elements are in a Windows PowerShell array?

Hey, Scripting Guy! Answer You can find the number of elements in a Windows PowerShell array in the following ways:

[array]$a = 1,2,3,4,5

$a.Count

$a.Length

$a.GetUpperBound(0)

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.