Looping through data with Foreach

PHOTO EMBED

Wed Dec 28 2022 01:12:47 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

$fruits = @('apple','pear','banana','lemon','lime','mango')

# Foreach block
Foreach ($fruit in $fruits) {
    Write-Host $fruit;
}

# Shorthand
$fruits.foreach( {
    Write-Host $_;
})
content_copyCOPY

https://lazyadmin.nl/powershell/powershell-script/