Option Explicit On Error Resume Next Sub include(vbs) Dim fso : Set fso = CreateObject("scripting.FileSystemObject") Dim p : p = Split(Wscript.ScriptFullName,"/") p(UBound(p)) = vbs p = Join(p,"/") Dim f : Set f = fso.OpenTextFile(p) Execute f.ReadAll() ' ExecuteGlobal f.ReadAll() f.Close() Set f = Nothing Set fso = Nothing ' Wscript.Echo(p) End Sub
include("1.vbs") include("2.vbs") 'If Err Then ' Wscript.Echo(Err.description) ' Wscript.Quit() 'End If Wscript.Echo(a+b)