In PowerShell + is the operator that you need to make use of to concatenate strings.
Let's take a look at a few examples.
Example 1: Using + operator
$firstName = "Chris"
$lastName = "Adams"
$name = $firstName + " " + $lastName
Write-Host "Name: $name"
Example 2: Using String interpolation
String interpolation is another way to concatenate Strings in PowerShell.
$firstName = "Sam"
$lastName = "Adams"
$name = "$firstName $lastName"
Write-Host $name

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!