【发布时间】:2015-01-21 16:16:11
【问题描述】:
我声明了一个元组数组如下:
[System.Tuple[string,string][]] $files = @()
我有以下工作流程:
Workflow Perform-Download
{
Param (
[Parameter(Mandatory = $true)]
[System.Tuple[string,string][]] $Files
)
ForEach -Parallel ($file in $Files)
{
Parallel{Save-File -Url $file.Item1 -DestinationFolder $file.Item2}
}
}
我正在尝试执行以下操作:
Perform-Download -Files $files
但我收到以下错误:
Perform-Download : Cannot process argument transformation on parameter 'Files'. Cannot convert the
"System.Tuple`2[System.String,System.String][]" value of type "System.Tuple`2[[System.String, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]][]" to type "System.Tuple".
At line:1 char:26
+ Perform-Download -Files $files
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Perform-Download], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Perform-Download
我做错了什么?
【问题讨论】:
标签: powershell arguments