I don't understand the purpose behind different combinations of quotation marks in VBScript. Can you explain the use of quotation marks in the code segment that Listing 3, page 6, shows?
The key to understanding quotation marks in VBScript is learning two basic rules about VBScript strings. First, a VBScript string is simply a series of characters enclosed in quotation marks (" "). Second, to embed quotation marks (") inside a VBScript string (quotation marks you don't intend to mark the end of the string), you need to escape the quotation marks with an escape character. But the VBScript escape character is also the quotation mark, which is the cause of the confusion.
Let's look at a simple example, then compare the example with the string in Listing 3. The following script displays status information as it runs:
WScript.Echo "Update Registry: Success"
This statement simply echoes (i.e., displays) the string Update Registry: Success. Suppose you want to enhance the script by storing the status portion of the string in a separate variable rather than coding it into a string. One approach that you can use is
strStatus = "Success"
WScript.Echo "Update Registry:" & strStatus
So far, the snippet is fairly straightforward. You simply echo a string constructed from two substrings: the literal prefix ("Update Registry: ") concatenated with the value stored in the variable named strStatus. Figure 2 shows the result echoed to the screen. . . .
Why become a VIP member?
 |
VIP-only online access |
 |
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library |
 |
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine |


Greymulkin October 25, 2004 (Article Rating: