In this tip you will learn how to list all folders in a directory.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("\\server1\sharedfolders")
Set objSubFolders = objFolder.SubFolders
For each objSubFolder In objSubFolders
wscript.echo objSubFolder
Next
Open CMD, navigate to your folder that has this vbs file and run cscript.exe filename.vbs.
You could also add | CLIP to copy to the clipboard: cscript.exe filename.vbs | CLIP