Chapter 15. Windows Script Host

Ask programmers if they use VBScript and most will answer "Yes, for ASP" or "Yes, on an intranet" or maybe even "Yes, for client-side scripting" (if their audience is made up entirely of people using Internet Explorer, unlikely nowadays). But you need to remember that these are nothing more than contexts where VBScript can be used to solve problems that are in need of scripting solutions. Because VBScript is designed as an ActiveX script engine, it can be used to provide scripting capability for any ActiveX scripting host environment.

Two of the most common hosts are:

  • Active Server Pages (ASP)

  • Internet Explorer

Both of these hosts provide the programmer with a lot of power but both also come with certain limitations. An example is that Internet Explorer does not provide a capability for script to interact with the local computer (such as file system access, registry access, and so on) unless the user explicitly sets permissions for this (and doing this can cause enormous security risks. For this reason, this is usually done only for trusted sites and intranets). So what's the point of having extended power within the VBScript language when you can't do anything with it? Well, this is where Windows Script Host (WSH) comes in. WSH is a totally scripting language-neutral host interface that will work with any ActiveX script engine. This means that programmers who want to use WSH can use VBScript, JScript, PerlScript, or any other scripting language that ...

Get VBScript Programmer's Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.