| |
tkdvipers
Posts: 7
Score: 0
Joined: 9/29/2006
Status: offline
|
Hi I am really new to this and I believe this is going to make a lot of you sigh. However I made a small script to list subfolders and files within a folder. The script works however I don't understand why some of it does. Here is the script: Option Explicit Dim objFso, strUserInput, objFolder, foldl, subf, file Set objFso = CreateObject("Scripting.FileSystemObject") strUserInput = InputBox("Please enter the path of the folder you wish to find " & _ "for example c:\windows\system32") If objFso.FolderExists(strUserInput) Then Set foldl = objFso.GetFolder(strUserInput) For Each subf In foldl.SubFolders < How does the script know what subf is?, I have declared it as a variable but thats all it is an empty variable WScript.Echo subf.Name Next For Each file In foldl.Files < I have the same question here, why does it recognise file as a file object, when all I have done is declared it as a variable WScript.Echo file.Name Next Else WScript.Echo "No" End If I have put my questions by the parts of the script I don't understand. I don't understand why the script recognises that subf as a subfolder or file as a file. I have only declared them as variables and not given them values. If someone could explain I would be most gratefull
|
|