Good question. I'm not aware of any definitive article.
An easy way to see the difference:
In the first case, each element is passed to get-member. In the second
case, the elements remain grouped together and are passed as a whole to
So at first, PowerShell sees the numbers 1 and 2 being passed, while in the
second, PowerShell sees a collection of 1 *and* 2 being passed together.
That being said, I'm not sure what's going on in your last example below.
"Kevin Buchan" <kevin.buchan@newsgroup[PlsDon'tSpam]sanders.com> wrote in
> I'm having trouble finding a definitive article on what exactly the
> leading comma does.
> PS C:\> $a
> PS C:\> $a = 1,2,3
> PS C:\> $b = 4,5,6
> PS C:\> ($a + $b).length
> It *seems* to treat what follows it as an element in an array, even if
> it's an array. So instead of creating a new array with all of the
> elements in $a and $b, it creates an array with all of the elements in
> $a and another array element with the entire $b array as that single
> PS C:\> ($a + ,$b).length
> PS C:\>
> PS C:\> $c = $a + ,$b
> PS C:\> $c.GetType().FullName
> PS C:\> $c
> PS C:\> $c
> When I try it before a string, I get an array with a single element,
> the string.
> PS C:\> $d = ,"Test","AnotherTest"
> PS C:\> $d.GetType().FullName
> PS C:\> $d.length
> PS C:\> $d
> OK, all of that seems reasonable to me. But, now here's where my mind
> gets blown...
> Why, in this example below, is the first element of $e a
> multi-dimensional array instead of just being a simple array of
> PS C:\> $e = ,(1,2,3),4,5,6
> PS C:\> $e.length
> PS C:\> $e.GetType().FullName
> PS C:\> $e # I expected this to return '2'.
> PS C:\> $e
> PS C:\> $e # What the heck?
> Kevin Buchan