Run a vbscript from another vbscript

markdigi picture markdigi · Nov 6, 2009 · Viewed 135.9k times · Source

How do I get a vbscript to run another vbscript?

Id imagine its only a few lines of code but not tried doing this before, nothing is passed between the 2, one just needs to call/run the other.

For examples the script being run is called TestScript.vbs, the other script for it to call/run would be called Secondscript.vbs, both of which are located in C:\Temp.

Thanks Mark

Answer

Martin picture Martin · Nov 6, 2009

See if the following works

Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")

objShell.Run "TestScript.vbs" 

' Using Set is mandatory
Set objShell = Nothing