For Each ... Next Loop
Loop through the items in a collection or array.
Syntax
For Each element In Group
[Statements]
[Exit For]
[Statements]
Next [element]
Key
element A variable used to hold each item in the group
Group A collection or a VBScript array
Example
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objDrive In objFSO.Drives
WScript.Echo objDrive.DriveType
Next
Set objFolder = objFSO.GetFolder("C:\Work")
Set arrFolders = objFolder.SubFolders
For Each strFolderName In arrFolders
WScript.Echo strFolderName
Next