Wednesday 19 March 2014

What Is Wsh | What Is Windows Script Host



JavaScript runs in browser with HTML support. What Is Wsh, What Is Wsh Act, What Is Wscript, Windows Script Host, Windows Script Host Reference, Wsh Script Example.
The WSH is an optional software element that supports the execution of scripts on Windows operating systems. It is tightly coupled with the operating system, meaning that it provides direct access to a number of Windows resources, including these:
Ø  The Windows desktop and Start menu
Ø  The Windows Quick Launch Bar
Ø  The Windows file system
Ø  Local and network printers and drives
Ø  Windows applications
Ø  Windows services
Ø  User accounts
Ø  The Windows registry
The WSH gives the most complete scripting environment available today for all Windows operating systems. When combined with a scripting language such as JScript, it provides a perfect platform for developing scripts that can automate virtually any Windows task.
Regardless of which of the Microsoft operating systems you own or support, you will want to make sure that you have upgraded the version of the WSH that is installed to the most current version. Microsoft provides access to the most current version of the WSH through its official scripting Web site, msdn.microsoft.com/scripting, where you can download WSH for free.
A Brief Overview of the WSH Architecture
The WSH provides built-in support for both JScript and VBScript. In addition, it can support any third-party, WSH-compatible scripting language, including PERL, Python, and REXX. In the future, third-party software developers may provide other WSH-compatible scripting languages. Microsoft designed the WSH to be very extensible, as evidenced by the number of third-party scripting languages that has already been set up to work with it. However, because JScript and VBScript are supplied with the WSH, they are the most commonly used scripting languages.
The WSH is a 32-bit application. Its architecture consists of three separate layers. First there are the various WSH-supported scripting engines. These scripting engines interpret script statements and pass them on to an execution host for processing.
The WSH provides two different execution hosts. The WScript execution host is designed to support the execution of scripts directly from the Windows desktop. The CScript execution host, on the other hand, is designed to support the execution of scripts from the Windows command prompt. Each of these execution hosts exists as a separate executable file named Wscript.exe and Cscript.exe, respectively.
With one exception, the WScript and CScript execution hosts provide the same level of functionality. This exception is the WScript execution host's capability to enable scripts to display text messages and collection input from users using graphical pop-up dialogs. This makes the WScript execution host the proper choice for scripts that need to interact directly with users. The CScript execution host, on the other hand, generally is used to run scripts that do not interact with users or to run scripts for users who are comfortable working from the Windows command prompt. However, the WScript execution host can be used to run scripts from the command line as well. Unless your script is designed to generate graphical pop-up dialogs, the choice of which script execution host to use is completely arbitrary.
The purpose of the WSH core object model is to provide access to Windows resources. It accomplishes this by defining objects that represent actual resources. These objects can then be accessed and manipulated by scripts, thus allowing the scripts to access and manipulate the resources that the objects represent. Examples of the types of objects that the WSH makes available include objects that represent Windows shortcuts, files, folders, and disk drives. The WSH also provides objects that represent network resources such as network drives and printers. On top of all this, the WSH object model also provides access to system resources such as Windows events logs and the Windows registry.
Every object that is presented by the WSH is associated with a collection of properties and methods. For example, a file is an example of an object. File objects have file names and file extensions. By accessing these file object properties, your JScripts can locate files that they want to work with. In addition, by modifying file object properties, your JScripts can rename files and change their file types.

No comments:

Post a Comment