Ansgar's JScript example will work with JScript version 2.0 and WSH 1.0.
There still isn't a true INCLUDE even in the current versions script languages (.wsf <script>
elements added in WSH 2.0 are a host feature, not a script language feature), only more techniques
to get that effect. If you're stuck with WSH 1.0 and version 2.0 language engines and you MUST have
the ability to "include" then you'll have to use JScript...
--
Michael Harris
MVP Scripting
Thanks for all the replies, I forgot to mention that this script will be
executing on one of our production servers, with NT4/OP. In other words, it
has WSH 1.0 with VBS 2.0 running, I cannot upgrade to WSH 2. Anyway, I
believe INCLUDE was not available in WSH 1, if I can recall correctly, if
not please let me now.
Khin Zaw
Seattle, WA
Quote:
> | Hi,
> |
> | How can I include another script file in WSH? Some examples,
please..
> | Appreciate it.
> |
> | Khin Zaw
> | Seattle, WA
> eval(Include("myfile.js"))
> function Include(file)
> {
> var fso, f;
> fso = new ActiveXObject("Scripting.FileSystemObject");
> f = fso.OpenTextFile(file, 1);
> str = f.ReadAll();
> f.Close();
> return str;
> }
> Greetings, Ansgar