Windows Scripting
WSH Windows Script Host
Is a programming Environment
Two Scrpit Engine's for WSH
VBscript
Jscript
cscript.exe - run from command prompt
wscript.exe-run from windows desktop
Example1:
MsgBox "Hello World"
save with extension .vbs
MsgBox( ) -Builtin VBScript Function
Example2:
Set genius = WScript.CreateObject("WScript.Shell")
genius.Popup "Hello World!"
genius = a variable
CreateObject = a Method (does something)
Here genius the variable is set to create
an instance of WshShell Object,by the Method.
Instance because WshShell Object will always
be the same,wont change.It's like a Clone of
WshShell is Spawned,by the Method.
Popup( ) is a Method of WshShell object.
Object , Methods --Google them.
Example 3:
WScript.Echo "Hello World"
Run this and example 1 using
CScript from command prompt.
First one gives a popup.
Now run both examples change CScript
to WScript and note the difference.WScript always
produces a graphical output.
Note:
WSH supports Python(originally for Linux
now Ported to Unix and Windows),
Perl,REXX(IBM,OS2)
WSH Core Object Model has 14 objects.
No comments:
Post a Comment