Set

Assign an object reference.

Syntax 
      Set variable = object   

The variable name, can be anything but typically will start with obj to indicate it is a programmable object with properties and methods.

Methods can be run against the object variable using the syntax objSomething.methodName

Properties can be accessed by assigning a variable: varValue = objSomething.propertyX

Unless you are using ADO objects that have to be explicitly cleaned up in the right order before they go out of scope, it is not necessary to assign object to nothing at the end of your scripts

Examples

Set objWshController = WScript.CreateObject("WshController")

“We can make good tests run fast but we can’t make fast tests be good” - Ryan Tomayko

Related VBScript commands

Dim - Declare a new variable or array variable.
VB Script Constants and Variables
Set Objects To Nothing? - Eric Lippert.


 
Copyright © 1999-2024 SS64.com
Some rights reserved