For some reason the following code does not work for me… I’m trying to learn VBS and I’ve been piecing together some code from resources on Google. I cannot figure out why I can’t get this to work.
Option Explicit
Dim objNetwork, objComputer
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory, strFile, MakeObject
strDirectory = "C:\test"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
Wscript.Echo strDirectory & " already exists"
Else
Wscript.Echo "The folder " & strDirectory & " does not exist"
Wscript.Echo "The folder " & strDirectory & " has just been created"
End if
Wscript.Quit
I think what Ekkehard.Horner is trying to say is this:
If you add the following to your script it will work. Rookie mistake, but good work, keep trying at it.. it will eventually make sense!
Here is your script with the added code and a note where to add it…