A Viper
A Viper

Reputation: 82

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

Upvotes: 0

Views: 1751

Answers (2)

William LEGO Tyler
William LEGO Tyler

Reputation: 1

Set x=CreateObject("Wscript.shell")
X.run "file name.vbs"

Upvotes: -2

GTAVLover
GTAVLover

Reputation: 1427

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.

Upvotes: 1

Related Questions