【发布时间】:2020-10-07 07:11:53
【问题描述】:
在 Foreach-Object Parallel 块下捕获错误的最佳方法是什么,因为将有三个单独的线程/运行空间运行并执行块中编写的代码,并且可能同时发生多个错误/异常?是否可以捕获列表/变量中的所有错误并在脚本执行结束时显示?
1..3 | ForEach-Object -ThrottleLimit 3 -Parallel {
#Some code here that throws error
}
【问题讨论】:
标签: powershell powershell-7.0 foreach-object