Windows Script Host/Shell COM object creation
Within this lesson you will learn how to create the Windows Script Host Shell COM Object
In order to create the object, you will need to create the object using this line of code
Set objShell = CreateObject("Wscript.Shell")
Syntax Breakdown
editCommand | Description |
---|---|
Set
|
This command makes the computer create a space in the memory to store an object. |
objShell
|
This is the object name the computer is assigning the memory location. (Variable name of your COM object). |
CreateObject(" ")
|
This initializes the creation of an object and causes the class named inside of the parenthesis to be inherited by the variable. |
Wscript.Shell
|
The class the variable inherits. |
Useful Class Methods
editMethod | Description |
---|---|
.Run
|
Run an application |
.ShellExecute
|
Runs an application through cmd.exe |
.Exec
|
Works like .Run but return exit/error code |