How to Write a General VBScript
Added 28 Jul 2008
Things You’ll Need:
- Windows Operating System (98 or Newer)
- Notepad (application)
- Knowledge of Command prompt
- Some knowledge of a scripting ;anguage
- Microsoft Visual Studio.Net Software (preferred)Step1Open Notepad. You can use this to write and edit the script.Step2Start each script with one specific line: Option Explicit.Step3Directly under the Option Explicit line you will need to declare your variables. You do this by using the DIM command. A variable is basically a nickname for information that is stored in a script.Step4Leave a space and then begin the Reference section of the script. The Reference section is where you assign values to the variables from Step 3. Simply state the variable, followed by an equal sign, and then the value of the variable.Step5Leave another space and begin the Worker section of the script. The Worker section is where the variables and references from Step 3 and 4 begin to get busy working. The use of the Set command will be found in this section of the script.Step6Leave a final space and begin the Output section of the script. The Output section is where the script will be told to echo results to the user or to a log file. This is where the “WScript.Echo” command will come into play.Step7After completion of the script save the script as a .vbs file. Once saved, you have several options of running the script. Some of the options available are double-clicking the file, using Command prompt to run the script with the CScript command, dragging and dropping the file into Command prompt, or running it through Visual Studio to check for errors.