VBScript: Restart a script automatically



My VBScript should run constantly on a server (Picking and mailing files).
So my question is:
What do I have to write at the end of my script, so that it will restart itself?

Thank you very much!
arthrexAsked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
While True

    ' your code in here....    

    ' optional pause before "restarting"....
    WScript.Sleep 5000 ' (max is 32,767 --> approx 30 seconds)

Wend
0
 
arthrexAuthor Commented:

That's great thank you very much!!

One last question. Why do I have to declare a constant outside the While-Loop?
(if I do so in the loop, it's throwing the error: Name already declared)

But I'm able to declare variables inside the loop?!
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Because a constant can't be changed...and if the declaration is inside the loop it's like your trying to set the constant to a different value when the line is hit again.

0
 
arthrexAuthor Commented:

thank you very much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.