#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3

    Kill VBS script after 4min


    Hi,
    I got to two directories, each directory is about 200GB in size (it has about 300000 small files) and have more than 1800 subfolders.
    I made a little VB script that reads both Dirs and writes the sizes of both Dirs to a text file.
    I could use Perl to do the same thing but VB is much faster, it takes up to 4 min to find the size of both Dirs.
    Now I noted my script runs in a loop and does not stop (it is trying to get the size of a first Dir) and I cannot kill it using the Task Manager because the XP box is not in Admin account.
    I was wondering is there anything I could put in to the script that would kill the script in 4min after it started.
    Thanks, testrV

    Code:
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile("C:\TETS\Dirsize.txt", True)
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder1 = objFSO.GetFolder("O:\TEST") ' folder to scan for size
    objFile.WriteLine "Drive1=" &objFolder1.Size
    
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder2 = objFSO.GetFolder("C:\TEST") ' folder to scan for size
    objFile.WriteLine "Drive2=" &objFolder2.Size
       WScript.Quit
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    With vbscript I don't think you can, there isn't a timer control that I know about available to vbs. You could use vb or some other language that supports timers, etc.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3
    Thank you Doug! As us usual you are very helpful.
    testerV

IMN logo majestic logo threadwatch logo seochat tools logo