Plus when you should use it
PowerShell Tutorial 8: ForEach Loops [Beginners]
The For loop is one of the most valuable tools in any programming language, and Microsoft PowerShell is no exception. You can use other loops to repeat commands, but the For loop is perhaps the simplest.
From iterating over arrays to executing a function a predetermined number of times, there are many things you can accomplish with this tool. Here's a tutorial on using For loops in PowerShell.
Unlike Command Prompt, PowerShell is a full-featured scripting environment. This means you can write reusable PowerShell scripts to perform tasks automatically instead of manually typing in commands. And For loops are the key to writing these modules.