Search code examples
stringpowershellmultiline

How to assign multiple lines string in Powershell Console


When I do enter this in powershell Console

$test=@'
Test
Test'@

And do enter several times, it keeps printing

>>

So I can never finish command.

What to do ?


Solution

  • $test=@'
    Test
    Test
    '@
    

    The important thing to note is that the delimiters include (invisible) carriage returns. There must be one at the end of the starting tag, and one before the closing tag.