PowerShell script error: the string is missing the terminator: PowerShell script error: the string is missing the terminator: powershell powershell

PowerShell script error: the string is missing the terminator:


It's similar with this question.

When you copy cmdlets from Web, maybe there are some special characters. I suggest you could copy the cmdlets to Notepad then copy to PowerShell.

It's helpful to use cat filename.ps1 in the terminal you can see determine which characters are bad, it's not obvious in the editor.


So parts of the code are copied and pasted from websites which have non-standard dash characters. I found it easier to see the characters when you use the cat command from the powershell command line to list the file

Here's a screenshot of what it looks like listed in the powershell:-enter image description here