Windows Script Host  

<object> Element

Defines objects in Windows Script (.wsf) files that can be referenced by a script.

<object id="objID" [classid="clsid:GUID" | progid="progID"] />


Required. A name that references the object in your script. Object ID values must begin with a letter and can include letters, digits, and underscores (_). The object ID must be unique throughout the scope of the Windows Script file.
Optional. The class ID (GUID) of the object.
Optional. Program ID of the object, which can be specified as an alternative to the class ID.


The <object> element provides a way to expose objects globally for use in scripting within the Windows Script file without using functions such as CreateObject(). Using an <object> element makes the object available with global scope and enables scripting tools to provide statement completion for the object's members.

You must specify either a classid or a progid.


<obect id="fso" progid="Scripting.FileSystemObject"/>
<script language="Jscript">

var a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");


See Also

<runtime> Element | <named> Element | <description> Element | <example> Element | <package> Element