Home › PowerShell › PowerShell Loop Through Array
PowerShell · Jan 19, 2018

PowerShell Loop Through Array

In this post, we will look at how to loop through an array in PowerShell.

We can define our array as:

$myArray = “one”, “two”, “three”

And loop through it like below:

foreach ($arr in $myArray) {
Write-Output $arr
}

Running this, we get:

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Carl de Souza
KEEP LEARNING. KEEP BUILDING.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.