Skip to Content
Microsoft® PowerShell, VBScript and JScript® Bible
book

Microsoft® PowerShell, VBScript and JScript® Bible

by William R. Stanek, James O'Neill, Jeffrey Rosen
February 2009
Intermediate to advanced
911 pages
17h 5m
English
Wiley
Content preview from Microsoft® PowerShell, VBScript and JScript® Bible

Chapter 2. VBScript Essentials

Microsoft Visual Basic scripting edition (VBScript) has long been the favorite scripting language of Microsoft developers and soon it will be your favorite as well. VBScript is easy to learn and use, making the language a great choice, especially if you don't have a programming background.

Working with Variables

Variables are a part of most scripting languages, and VBScript is no exception. A variable is simply a placeholder for a value you want to work with.

Variable naming

You can create a variable by assigning the variable a name, which you can refer to in your code later. Variable names, like other VBScript structures, follow standard naming conventions. These naming rules are as follows:

  • Names must begin with an alphabetic character.

  • Names cannot contain periods.

  • Names must be less than 256 characters in length.

Variable names also have an additional property, which isn't the case of other structures in VBScript. They are case-sensitive, meaning value1, Value1, and VALUE1 are all different variables. However, method, function, and object references in VBScript are not case-sensitive. For example, you can echo to the screen using any of the following commands:

wscript.echo "This is a test!"
Wscript.echo "This is a test!"
WScript.Echo "This is a test!"

But in reality, the correct capitalization for this reference ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Windows PowerShell

Learning Windows PowerShell

Mark Long
Learn PowerShell Core 6.0

Learn PowerShell Core 6.0

David das Neves, Jan-Hendrik Peters

Publisher Resources

ISBN: 9780470386804Purchase book