Display in one window, instead of several
Posted on 2006-07-10
The script below displays the size of immediate sub-directories within c:\documents and settings. How may I cause it to display in one windows, instead of one-each for each result?
Dim objFSO, objFolder, objSub, nTotal
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("c:\documents and settings")
nTotal = 0
'loop through each subfolder, displaying its size
For Each objSub In objFolder.SubFolders
Wscript.Echo "Folder " & objSub.Name & " is " & ((objSub.Size)/1048576) _
& " MB"
ntotal = nTotal + ((objSub.Size)/1048576)
Wscript.Echo "Total for all folders:" & nTotal & " MB"