PS
Powershell Tutorial Online

powershell-concatenate-strings

Every object has a view registered to it. The particular view defines which formatter to use. We discuss output more in depth in another tutorial. For additional Windows PowerShell Commands Please see following links..

There are many ways in which one can manipulate the objects. The simplest object to deal with and the one we are going to be working with in this tutorial is a string. The following code displays, Dan Daman:

Example


$firstname = "Dan"
$lastname = "Daman"
$fullname = $firstname + " " + $lastname
write-output $fullname


Copy and Try it

Concatenate strings and variables in PowerShell?

Example

$myObj = New-Object psobject -Property @{
    Id = 31
    Name = "Vinod Shitole"
    Owner = "XYZ"
}

Write-Host "$($myObj.Id) - $($myObj.Name) - $($myObj.Owner)"


Output:
31 - Vinod Shitole - XYZ

Example