Taking Advantage of VBScript’s Colon
To save space in a script, you can take advantage of VBScript’s vastly under-used colon. The colon lets you join two lines of code.
Alistair G. Lowe-Norris
April 22, 2001
1 Min Read
To save space in a script, you can use VBScript's colon (:) to join two lines of code. Using a colon tells Windows Script Host (WSH) to treat the code that follows as if it were a new line. For example, you can join these two lines of code
Dim strUrgentstrUrgent = "This variable contains my urgent text string."
by inserting a colon between them:
Dim strUrgent : strUrgent = "This variable contains my urgent text string."
You aren't limited to using the colon to join variables with their declarations. You can use the colon to join any two lines of code. You just need to put a space before and after the colon.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like