mysql 命令休止符_PowerShell脚本错误:字符串缺少终止符:(PowerShell script error: the string is missing the terminator:)...

本文探讨了一个简单的PowerShell脚本问题,该脚本用于设置Azure存储上下文时出现的错误。作者指出,在文件中运行时会遇到错误,但在PowerShell命令行中复制粘贴相同的脚本内容却能正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Incredibly simple powershell script...

#Server side storage copy

$SourceStorageAccount = "myStorageAccount"

$SourceStorageKey = "myKey"

$SourceStorageContext = New-AzureStorageContext –StorageAccountName $SourceStorageAccount -StorageAccountKey $SourceStorageKey

fails with the error

At E:\DeploymentScripts\Storage\Test.ps1:6 char:51 + ... geContext –StorageAccountName $SourceStorageAccount -StorageAccount ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The string is missing the terminator: ". + CategoryInfo : ParserError: (:) [], ParseException + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

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...

4eKyD.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值