1. Technology

VBScript - The System Administrator's Language - Part 1


6 of 6

Running the Example ... and what's next
Run VBScript with CScript

Run VBScript with CScript

To try out this script, simply copy and paste it into Notepad. Then save it using any name ... such as "CreateLink.vbs". Remember that Notepad will add ".txt" to files automatically in some cases and the file extension must be ".vbs" instead. Then double click the file. A shortcut should appear on your desktop. If you do it again, it just recreates the shortcut. You can also start the DOS Command Prompt and navigate to the folder that the script was saved in and run it with the command ...

cscript scriptfilename.vbs

... where "scriptfilename" is replaced with the name you used to save it. See the example shown in the screenshot above.

Give it a try!

One caution: Scripts are used a great deal by viruses to do bad things to your computer. To combat that, your system may have software (such as Norton AntiVirus) that will flash a warning screen when you try to run this script. Just select the option that allows this script to run.

Although using VBScript in this mode is great, the real payoff for most people comes in using it to automate systems like WMI (Windows Management Instrumentation) and ADSI (Active Directory Service Interfaces). In the next segment of this lesson, we take a closer look!

  1. About.com
  2. Technology
  3. Visual Basic

©2014 About.com. All rights reserved.