Overview Of The New Windows Scripting Host 5.6 - New Contestants, Come On Down!
(Page 4 of 7 )
Now, what about Perl, Python, and all those other scripting languages that I promised you that you could run? After all, don't they have other extensions, like .plx and .py? Unfortunately, it wasn't until version 2.0 that WSH could run anything other than .vbs and .js scripts. In the later versions, Microsoft teamed up with a number of third parties to increase scripting language support for WSH. Still, if you try to run a Perl program with a .plx extension, it'll simply run as a Perl program. The same goes for Python. The way Microsoft's added this functionality and still kept it all under control is by implementing XML and tacking on the .wsf extension to these files. The biggest advantage of doing this is the ability to run multiple languages within one script, such as is the case in the following script:
< ?XML version="1.0" ? >
<!-- Filename: Hello.wsf-->
<job>
<script language="VBScript">
WScript.Echo "Hello, from you VBScript friends! Please press OK."
</script>
<script language="JScript">
WScript.Echo ("Hey, this is JScript. Can you click OK again? I can't quite reach it.") ;
</script>
</job>
Notice the switch in languages in line 7. This functionality allows you to perform multi-paradigmic tasks in one script. This comes especially handy when you're dealing with two totally different languages, such as VBScript and PerlScript. It also makes it easier to write reusable code and specify references to external type libraries.
Now that you understand a bit about what WSH is and what it does it's time to start using it.
Next: Let's Get This Show On The Road >>
More Windows Scripting Articles
More By Norbert Cartagena