For some reason PowerShell takes an array of strings and converts it into a single string (or perhaps a character array?) when it is set as the second dimension of a two dimensional array:
Here is the initial output of the $path array:
PS C:\Users\crd> $path
C:
Program Files (x86)
Common Files
Adobe
ARM
1.0
armsvc.exe
The path[0] array entry is a string value:
PS C:\Users\crd> $path[0]
C:
Now we set the first value in the $test[] array equal to our string array:
PS C:\Users\crd> $test[0]=$path
You can see that the entire string array has been merged:
PS C:\Users\crd> $test[0]
C: Program Files (x86) Common Files Adobe ARM 1.0 armsvc.exe
Why is this? I'm sure Microsoft documented this somewhere but I'm having a hard time finding it.
I would expect the output to remain unchanged. Note the following output:
PS C:\Users\chris> $test[0][0]
C
I would like this to be the same as the $path[0] output which was C:. Why is this merge occurring?
$pathcome from? What type is it? Why do you want to work with multi dimensional arrays?$test, how is this different from the question you asked yesterday and why do you keep wanting to re-appropriate and reuse the same variables? :)