Answer by John Ludlow:

Thanks for the A2A.

The short answer is that this code is creating an instance of an object with the ID "wscript.shell" and using it to invoke notepad.

You want a longer answer?

COM Objects

COM stands for Component Object Model (COM). In short, it's a mechanism that allows disparate languages and frameworks to interact. For example, a vbscript can use COM objects to invoke functions written in C.

Objects are registered – usually by using the regsvr32.exe utility which drops a lot of information in the registry, including a string ID and where the host DLL can be found.

To create a COM object in vbscript, you use the…

CreateObject Function (Visual Basic)

This function takes a string to identify the object, and returns an instance of the specified object.

WScript.Shell happens to refer to the…

WshShell Object

This object provides functionality usually associated with Explorer – such as creating shortcuts and running processes.

Your snippet seems to use the object's…

Run Method (Windows Script Host)

This method takes a string which is the command to run, which in your case seems to point to…

Notepad (software)

Notepad is a text editor included with Windows. If you launch it with no parameters, you will get a default blank document called Untitled.txt.

What can you tell me about vbscript of: createobject ("wscript.shell")?

Advertisements