Tuesday, March 19, 2024

Multidimensional arrays in Powershell

Because of the reason that most persons do not know that Powershell can handle Multidimensional arrays, here is a small snippet to demonstrate that

$MultidimensionalArrays = @(1,2,3), @(4,5,6), @(7,8,9)

foreach($Arrays in $MultidimensionalArrays) 

    Write-host ($Arrays) # List array content using foreach()

    Write-host “Index1:”($Arrays)[0]
    Write-host “Index2:”($Arrays)[1]
    Write-host “Index3:”($Arrays)[2]
}

 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

35FollowersFollow
- Advertisement -

Latest Articles