A Windows Scripting Host Tutorial - Better Than Batch

windows scripting host tutorialIf you’ve been working in the computer world for a while then you’re probably pretty familiar with batch jobs. IT professionals around the world utilized them to run all sorts of automated computer processing jobs and personal tasks. In fact Paul recently covered how to write such a file.

The problem with batch jobs is that they were very limited. The command set was somewhat short and didn’t allow for very much functionality when it came to structured logic using if-then, for, next and while loops.

Later, Windows Scripting Host came along. The MS Windows Scripting Host is a multi-language script utility that Microsoft started installing as standard on all PCs from Windows 98 onward. By the second generation of the tool, it was renamed to Microsoft Script Host (MSH).

A Microsoft Scripting Host Tutorial

Here at MUO, we love computer automation. For example, Varun covered Sikuli, a tool to write automation scripts, and Guy showed you how to use AutoIt to automate tasks. The cool thing about MSH is that if you have any post-Win 98 PC, you can write a “batch” script in a variety of languages.

Available languages include JScript, VBA, and VBscript. It’s also possible to write scripts in Perl, Python, PHP, Ruby or even Basic if you have the right implementation with the right scripting engine.
Personally, I know Visual Basic well, so I usually opt for VBScript. The beauty here is that you don’t need any special programming software or compiler. Just open up Notepad and write your script, just like how you wrote your batch jobs.

Without installing anything, you can write scripts in VB. The simplest script is printing text to a pop-up window, like this:
windows scripting host tutorial
Save the file as a .vbs and Windows will recognize and run it. This is what happens when you double click on the file above:
windows scripting
You can write more advanced scripts utilizing the languages you’re accustomed to. For the most flexibility, place and

Comments

Popular posts from this blog

HPONCFG GUI Utility / Tool Download Links - x32 & x64 bit versions, 2003 & 2008 Windows Versions

IBM x3650 M4 Series Server Model - Activation Keys Backup to be taken for IMM Moduel II, why?

How To: Steps to Boot HP Proliant Server with internal USB flash drive