Code:
 

for each $folder in FolderList('%ProgramFiles%')
? $folder
next


Function FolderList($folderName,optional $mask)
dim $objDir, $objFile, $t, $name
$objDir = CreateObject('Scripting.FileSystemObject').GetFolder($folderName).SubFolders
if @error exit 1 endif ; usually folder not found
For Each $objFile In $objDir
$name=$objFile.name
if ($mask and instr($name,$mask)) or not $mask
$t=$t+'|'+$name
endif
Next
$FolderList=split(substr($t,2),'|')
$objDir = 0
EndFunction


_________________________
How to ask questions the smart way <-----------> Before you ask