Skip to main content
the explanation was moved from the comment to the answer
Source Link
Yan Sklyarenko
  • 32.5k
  • 25
  • 109
  • 144

Try it like below:

start-job -filepath myscript.ps1 -arg (,$myarr)

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.

Try it like below:

start-job -filepath myscript.ps1 -arg (,$myarr)

Try it like below:

start-job -filepath myscript.ps1 -arg (,$myarr)

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.

Source Link
manojlds
  • 303.2k
  • 66
  • 482
  • 426

Try it like below:

start-job -filepath myscript.ps1 -arg (,$myarr)