vbscriptrestart

Restart vb script


I'm trying to make a Vb script that restarts another vbs script the problem is I'm new to this and I don't know how to do this, someone suggested using WshShell I have tried a few websites on how to use it but nothing. Here is what I've got,

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("Test_To_Block.vbs")
Do
If NOT WshShell.Status = 1 then
    WScript.Exec("Test_To_Block.vbs")
End If
WScript.Sleep(100)
Loop

Thanks,

Regards,

A Viper


Solution

  • Yes, you can use Exec method to run another VB Script, but you are likely to get a console window flash.

    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Exec("CMD /C Test_To_Block.vbs")
    

    Refer to SS64 site to learn about VB Script basics.