Windows Script Host object model

The Windows Script Host object model gives you a logical, systematic way to perform many administrative tasks. The set of COM interfaces that it provides has two main categories.

Script execution and troubleshooting

Properties and methods directly related to script execution. This set of interfaces allows scripts to perform basic manipulation of the Windows Script Host, display messages on the screen, and perform basic COM functions such as CreateObject and GetObject.

Helper functions

Properties and methods for performing actions such as mapping network drives, connecting to printers, retrieving and modifying environment variables, and manipulating registry keys. Administrators can also use the Windows Script Host helper functions to create simple logon scripts

Object

What you can do with this object

WScript

Set and retrieve command-line arguments

Determine the name of the script file

Determine the host file name (Wscript.exe or Cscript.exe)

Determine the host version information

Create, connect to, and disconnect from COM objects

Sink events

Stop the execution of a script programmatically

Send information to the default output device (either a dialog box or the console)

WshArguments

Access the entire set of command-line arguments

WshNamed

Access the set of named command-line arguments

WshUnnamed

Access the set of unnamed command-line arguments

WshNetwork

Connect to and disconnect from network shares and network printers

Map to and disconnect from network shares

Access information about the user who is currently logged on

WshController

Create a remote script process using the Controller method CreateScript() 

WshRemote

Remotely administer computer systems on a computer network

Programmatically manipulate other programs and scripts

WshRemote Error

Access the error information that is available when a remote script (a WshRemote object) terminates as a result of a script error

WshShell

Run a program locally

Manipulate the contents of the registry

Create a shortcut

Access a system folder

Manipulate environment variables, such as WINDIR, PATH, or PROMPT

WshShortcut

Programmatically create a shortcut

WshSpecialfolders

Access any of the Windows special folders

WshURLShortcut

Programmatically create a shortcut to an Internet resource

WshEnvironment

Access any of the environment variables, such as WINDIR, PATH, or PROMPT

WshScriptExec

Determine status and error information about a script that is run with Exec() 

Access the stdIn, stdOut, and stdErr channels

In addition to the object interfaces provided by Windows Script Host, administrators can use any ActiveX control, that exposes automation interfaces, to perform various tasks on the Windows platform. For example, administrators can write scripts to manage the Active Directory directory services.

For more information, see the Windows Script Technologies Web site at the Microsoft Web site.

Set properties for individual scripts that are run with the Windows-based script host (Wscript.exe)

Set global properties for all scripts that are run with the Windows-based script host (Wscript.exe)

Run Windows Script Host samples

Run scripts using the Windows-based script host (Wscript.exe)

Run scripts using the command-line-based script host (cscript.exe)

Windows Script Host overview

Windows Script Host object model

Download Windows Script Host samples



© 2015 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy & Cookies