O'Reilly logo

Microsoft® Windows PowerShell™ Step By Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Looping Through Code

A fundamental concept in any programming language is the use of looping techniques. Because everything in Windows PowerShell is an object, looping techniques not only become much more important but also are inherent in the way you use the scripts. Most of the time, you will not have to stop and think, "Do I need to use a looping technique here?" Rather, it will be intuitive, and you will probably find yourself performing the looping without thinking.

Using the ForEach-Object Cmdlet

If you were tempted to call this the for … each … next statement (as it was called in VBScript), then I have good news for you. In Windows PowerShell, there is no "next" required for the ForEach-Object cmdlet. Therefore, you will never forget to close ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required