November 14th, 2012, 12:39 PM
-
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
November 14th, 2012, 07:06 PM
-
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
======
I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
November 16th, 2012, 11:34 PM
-
Thank you Doug! As us usual you are very helpful.
testerV