1
我只是Powershell腳本的新手。我只是在PowerShell腳本創建了一個方法 -將特殊字符作爲參數傳遞給Poweshell腳本函數
function Add-Entity() {
[CmdletBinding()]
param(
$TableName,
$PartitionKey,
$RowKey,
[String]$JsonString
)
$entity = New-Object -TypeName Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity -ArgumentList $PartitionKey, $RowKey
$entity.Properties.Add("JsonStringProperty", $JsonString)
$result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage.Table.TableOperation]::Insert($entity))
}
,我想通過這個完整的JSON字符串作爲參數 -
Add-Entity -TableName $myTableName -PartitionKey "ABC" -RowKey "XYZ" -JsonString {"TO":["[email protected]","[email protected]"],"CC":["[email protected]"],"BCC":[]}
每次我嘗試編譯,它給了我一個錯誤 -
Unexpected token ':["[email protected]".com"' in expression or statement
工作就像一個魅力。謝謝! –