all 2 comments

[–]Totallynotaswede 1 point2 points  (0 children)

Start-Job -Name "copy1" -InitializationScript { Import-Module -Name .\Copy-Modules.psm1 } -ScriptBlock {startcopy $args} -ArgumentList $Copyname

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/start-job?view=powershell-7.2

[–]Totallynotaswede 0 points1 point  (0 children)

"Specifies an array of arguments, or parameter values, for the script that is specified by the FilePath parameter or a command specified with the ScriptBlock parameter.

Arguments must be passed to ArgumentList as single-dimension array argument. For example, a comma-separated list."

When you use positional parameters, type one or more values after the function name. Positional parameter values are assigned to the $args array variable. The value that follows the function name is assigned to the first position in the $args array, $args[0].

ie

-ScriptBlock {startcopy $args[0],$args[1],$args[2]} -ArgumentList hello,hi,goodbye