可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Incredibly simple powershell script...
fails with the error
The strangest part is if I copy and paste the contents of the ps1 file into a PowerShell command line, it works fine !? What's going on?
Obviously I have removed my storage container name and key, you will need to assign your own Azure storage account name and api key to replicate it.
EDIT: A screen shot of the script edited in Notepad++ with all characters visible...

回答1:
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.
回答2:
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:- 