You are looking at a here-string. The error is from a malformed here-string.
The code you have above copies and works just fine as is. The start must finish the line and the end of the here string must be alone on it's own line. Which they are in your code in the question. I can create your error by adding some spaces before the terminator "@
.
$Win32ShowWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
I would double check the code you are actually using. Guessing you will find leading whitespace like the error is suggesting. There is a comment in the page you linked to that talks about removing that whitespace from the code. You copied and pasted from that site which had leading whitespace.
Taking a line from devcentral.f5.com
A here-string is used to embed large chunks of text inline in a script into a single string literal. This is very similar to a feature in C#, but the difference is that in PowerShell the here-string begins at the end of a line and the terminating sequence must be at the beginning of a line.
Using double quotes will allow for variable expansion whereas single quotes will not. Just like normal strings in PowerShell.
I also see smart quotes but, like you said, that didn't help when you changed them. In general keep an eye out for those.