$ll = @("a","b","c"); ForEach ($e in $ll) {Write-Host $_}
I've spent too much time on this already and I'm tired of searching and fiddling. Who wants to make me feel silly by explaining why this PowerShell code produces no output? No errors. Just 3 new blank lines.
Edit: I know what $_ is and what it's supposed to do. It's simply not working in this loop. Thx
$_has a value only in aForEach-Objectpipeline. What you have here is aforeachloop. UseWrite-Host $e-- you didn't declare that$efor nothing!foreachandForEach-Objectare not the same, one is a language keyword the other is a cmdlet.$_is auto populated in scriptblocks that process the current object, such as in the pipeline.foreachdocumentation. Not sure how more clear could we be. Jeroen's comment should be clear enough. learn.microsoft.com/en-us/powershell/module/…