O'Reilly logo

Windows PowerShell™ 3.0 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

Using the Do...While statement

The Do While...Loop statement was often used when working with VBScript. This section covers some of the advantages of the similar Do...While statement in Windows PowerShell.

The DemoDoWhile.vbs script illustrates using the Do...While statement in VBScript. The first thing you do is assign a value of 0 to the variable i. You then create an array. To do this, you use the Array function, and assign the numbers 1 through 5 to the variable ary. You then use the Do While...Loop construction to walk through the array of numbers. As long as the value of the variable i is less than the number 5, you display the value of the variable i. You then increment the value of the variable and loop back around. The DemoDoWhile.vbs ...

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