更新时间:2023-11-07 13:56:58
尝试如下所示:
start-job -filepath myscript.ps1 -arg (,$myarr)
-ArgumentList
接受参数列表/数组.因此,当您提供-arg $myarr
时,就好像您要传递数组的元素作为参数一样.因此,您必须强制PowerShell将其视为单个参数(即数组).
The -ArgumentList
takes in a list/array of arguments. So when you give -arg $myarr
, it is as though you are passing the elements of the array as the arguments. So you have to force PowerShell to treat it as a single argument which is an array.