Converting VBScript's Concatenation Operator

Definition: Forces string concatenation of two expressions.

Concatenation Operator

In VBScript you can join two or more strings by using either the plus sign (+) or the ampersand (&).

Note. Or, if you want to sound fancy: In VBScript you can concatenate two or more strings by using either the plus sign (+) or the ampersand (&).

In Windows PowerShell you can concatenate two or more strings by using the plus sign (don’t even bother trying to use the ampersand). For example, this command combines the word test, a blank space, and the word value and stores the resulting string in a variable named $a:

$a = "test" + " " + "value"

When you run this command and then echo back the value of $a you should get the following:

test value

Return to the VBScript to Windows PowerShell home page