Vbscript

5 pts.
Tags:
Looping
VBScript
VBScript Date Format
how to loop a script until a particular file's date and time has changed. once date or time has changed end the loop

Answer Wiki

Thanks. We'll let you know when a new response is added.

I am looking into this…Stand By…

OK the script follows. Be aware though, that the loop will continue indefinately until the date or time on the file changes. This means it could be fairly process hungry and slow down your system. For that reason I placed a “doEvents” call to allow windows to process other stuff

Let me know if this works for you…

<pre>
Dim fs, f, d1, d2
Set fs = CreateObject(“Scripting.FileSystemObject”)
Set f = fs.getFile(“c:\autoexec.bat”) ‘place the name of your file here
d1 = f.dateLastModified
Do While True
d2 = f.dateLastModified
If d2 <> d1 Then
Exit Do
End If
DoEvents
Loop
</pre>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Craisin
    Any response to my question?
    70 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following