Thread: VBscript help!

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    7
    Rep Power
    0

    VBscript help!


    Hi, I'm trying to create a simple script that checks the system time and names a folder after it, and then calls an application to run. I'm in the initial stages right now, learning how to create a folder. I found the below code on MS's website, but when I run it using CScript c:\New Folder is not created! Please help

    Function CreateFolderDemo
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.CreateFolder("c:\New Folder")
    CreateFolderDemo = f.Path
    End Function
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    How are you calling the function?
    i.e. show your code
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    7
    Rep Power
    0
    Don't laugh, but I don't think I am. That's the entire body of my vbs file. I would appreciate knowing how to call a function.

    I then run the file on the command prompt with cscript //d backup.vbs
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    7
    Rep Power
    0
    Wait, there we go. I added a call CreateFolderDemo() and it works fine now.

    thank you
  8. #5
  9. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    Here is a sample
    Code:
    Function CreateFolderDemo()
            Dim fso, f
            Set fso = CreateObject("Scripting.FileSystemObject")
            Set f = fso.CreateFolder("c:\success")
    				CreateFolderDemo = f.Path
    End Function
    
    Dim temp
    temp = CreateFolderDemo()

IMN logo majestic logo threadwatch logo seochat tools logo