Creating Scripts That Can Be Used by WSH

 

A Windows script is a text file. You can create a script with any text editor as long as you save your script with a WSH-compatible script extension (.js, vbs, or .wsf).

The most commonly available text editor is already installed on your computer — Notepad. You can also use your favorite HTML editor, Microsoft Visual C++, or Visual InterDev.

To create a script with Notepad

  1. Start Notepad.

  2. Write your script. For example purposes, type WScript.Echo("Hello World!");

  3. Save this text file with a .js extension (instead of the default .txt extension). For example, Hello.js.

  4. Navigate to the file you just saved, and double-click it. (You may have to specify the Windows Script Host as the application to use.)

  5. Windows Script Host invokes the JScript engine and runs your script. In the example, a message box is displayed with the message "Hello World!"

See Also

Reference (Windows Script Host)
JScript Language Reference (Windows Scripting - JScript)
VBScript Language Reference