PowerShell - Getting Started with Lists

by
Jeremy Canfield |
Updated: April 25 2023
| PowerShell articles
Here is how you would create a list that contains a few items.
$mylist = @("apple","banana","orange","grapes")
foreach ($item in $mylist) {
Write-Host "item = $item"
}
Which should print the following.
item = apple
item = banana
item = orange
item = grapes
Did you find this article helpful?
If so, consider buying me a coffee over at