Have you ever wanted to include another .vbs file with all your common functions in a script?

Many people I have met thought it wasn’t possible.

But it is actually pretty easy to do with “ExecuteGlobal”

to make it even easier, I have created a small function which you can put in your scripts and use a simple

Include(“C:\functions.vbs”)

I have made 2 small example scripts to show you how to use it:

Functions.vbs:

This file could be a shared file with all your common functions such as Log writer.

Include-Example.Vbs

Then everytime you create a script you include the function and make sure to include the other vbs files in the beggning of the script.

Now you have access to all the functions from the other scripts, from inside your new script!

and the next time the management tells you to change the Log Format to a different date/time format, so simular. You just have to change the function in the shared file, instead of editing all your scripts!

But beware not to corrupt the shared file, cause it will make all your scripts fail 😉

Merry x-mas!