Include many .vbs files in a single file ?

Is it possible to include code from many .vbs executed as a single file?
Just like the Include() command in PHP....

Thanks
LVL 1
New_AlexAsked:
Who is Participating?
 
bitwise-bnccCommented:
Yes it can be done using this function:
Sub Include(vbsFile)
dim fso
dim f
dim s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.OpenTextFile(vbsFile)
  s = f.ReadAll()
  f.Close 
  ExecuteGlobal s
End Sub

Open in new window

Then in the startup procedure of your "main file" you call this function:
Include "SendManagedMail_inc.vbs"

Open in new window

0
 
Bill PrewCommented:
There is no "include" capability, the best you have is functions and subroutines in a single VBS.

~bp
0
 
New_AlexAuthor Commented:
Yes Sir/.
This works !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.