If you’re an experienced Windows user, you’ve probably used batch files at one time or another. Batch files allow you to automate tasks that you perform repetitively, but they are pretty weak and unstructured. It can also be difficult to debug them and get them to work correctly, and they have some strict limitations that severely limit their capabilities.
The Windows Script Host (WSH) is a powerful scripting solution that enables you to do everything that is possible with batch files – plus much, much more! When you have WSH running on your computer, you have the capability to run scripts that use the Microsoft VBScript or JScript languages to automate your tasks. WSH is also flexible enough to support other languages, thanks to it’s modular architecture. Furthermore, WSH enables you to automate practically everything in Windows because it’s plugged in to the standard OLE/ActiveX capabilities.
This means that it can be used to automate barcode Generation with the TAL ActiveX barcode control, to send barcodes to Word, Excel, PowerPoint, Access or a web Browser, even to Outlook and have it automatically e-mailed to a client.
Where can I find it?
WSH is an intrinsic part of Microsoft Windows 98 and Windows 2000, and a free download from Microsoft for Windows 95 and NT 4.0.
A Word of Caution
Because of its powerful scripting engine and the sheer number of machines that have it installed simply because WSH is part of the Windows Operating System, many virus writers have exploited its use. The “I Love You” Virus (this link takes you to information about the virus on McAfee’s website – it is not a link to the virus!), was nothing more than a file with a .VBS extention, when an unsuspecting recipient double clicked on the email attachment, the VBScript executed and the users system was infected.
How to Protect your PC
If you have no plans to use the Windows Script Host you can secure your system against such exploitation by changing the behavior of .vbs files so that instead of running the code they open the code in notepad.
Also check out our WSH Example Code