Author : MD TAREQ HASSAN | Updated : 2023/03/17

Basic interpolation

$hlo = "Hello"
$msg = "$hlo PowerShell!"
Write-Host $msg

$folder = 'C:\test'
$fileName = 'foo.txt'
$filePath = "$($folder)\$($fileName)"
Write-Host "file path: $filePath"

Interpolation for multiline string

$greeting = 'Good morning'

$textBlock = @"
$greeting!
  How are you today?
"@

Write-Host $textBlock