Working with VBScript Objects
When you need to use an object, it must first be instantiated. For example;
Set objFSO = CreateObject("Scripting.FileSystemObject")
This example uses the FileSystemObject to allow access to files, folders, drives and text files.
Dim objFSO, objFolder, objFile, objNewFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\scripts\")
Set objNewFolder = objFSO.CreateFolder("C:\Test")
For Each objFile In objFolder.Files
objFile.Copy "C:\test\"
Next
The above script will create a folder called “Test” on the C: Drive and copy the contents of the C:\Scripts folder into the new test folder.
Become a Member
Start learning about VBScript right now!
Become a Member and begin downloading our VBScript Videos Immediately!
These VBScript Videos are from our VBScript Product
|