[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2488
  • Last Modified:

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!
0
arthrex
Asked:
arthrex
  • 2
  • 2
1 Solution
 
Mike TomlinsonMiddle 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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now