我尝试通过以下方式并行化某些文件传输:
Workflow DownloadFiles{
Write-Output "Beginning workflow."
foreach -parallel ($dir in $destinations)
{
try{
Write-Output "Copying to to: " $dir
InlineScript{
&"$AzCopyPath" /Source:"$sourceDirectory" /Dest:$dir /SourceKey:$sourceKey /Pattern:"$sourcePattern"
Write-Output "Copied to: " $dir
}
}
catch{
InlineScript{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Output $dir : $ErrorMessage $FailedItem -ForegroundColor Red
}
}
Write-Output "Done";
}
}
然而,脚本立即结束,没有输出。即使我尝试这个,我也什么也得不到:
Workflow DownloadFiles{
Write-Output "Beginning workflow."
Write-Output "Done";
}
我做错了什么?