Today I was writing a bit of raw XML to be used as a SOAP message. Being a person who enjoys writing easy to read code, I declared my variable using here-string notation, pasted in the appropriate XML between the @” and “@, making sure to indent everything along the way including the last “@.
Then when I saved my work and tried to run the script, I kept getting an error claiming the “@ terminator was missing. Fast forward a couple minutes of head scratching, checking, double-checking , and triple-checking that there was, indeed, a double-quote followed by an at symbol. Finally I figured it out. The here-string’s “@ terminator needs to be on its own line, with no preceding white-space/tabs/whatever.
And there we have it: my forehead-slapping moment, transformed into a helpful PowerShell quick tip. 🙂
Brilliant!!!
Thx! Saved me some headscratching.
Thanks! That was the exact same situation- head scratching and couldn’t figger it out until I saw your post.
Thanks a lot it saved a lot of time , simple thing but most important. I browsed thought lot of sites but no one spelled this point.
Thanks a lot
SreekanthCHAVA
Thanks!
I can’t get it to work. Each time I enter it, I get this #*#*# error !
PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> $chunk=@”
The string is missing the terminator: “.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
Thanks dude, this helped me alot with my script!
Thanks mate, you saved me a lot of time by sharing this with community !!