Have you ever wondered how you can recursively call a JScript? Here is an example which shows how it can be done:


WshShell = new ActiveXObject("WScript.Shell");
switch(WshShell.Popup("Do you want to run this script again?", 10, "Run Script Again", 4 + 32))
{
  case -1:
    WScript.Echo("I guess you aren't there.  See'ya!!!");
    break;
  case 6:
    WshShell.run('"' + WScript.ScriptFullName + '"');
    break;
  case 7:
    WScript.Echo("Take it easy.");
    break;
}

It is important to note that the above example will not pass any variables that were passed to it. If you want to try this out on your Windows machine, download Recursive Script to your computer and double-click it.

Categories: BlogJScript

Leave a Reply

Your email address will not be published. Required fields are marked *