Parallel Processing (Multithreading)
Aus Wiki-WebPerfect
Version vom 3. Juli 2020, 12:16 Uhr von Admin (Diskussion | Beiträge)
PowerShell instances
$a = [PowerShell]::Create().AddScript{sleep 5;'a done'} $b = [PowerShell]::Create().AddScript{sleep 5;'b done'} $c = [PowerShell]::Create().AddScript{sleep 5;'c done'} $r1,$r2,$r3 = ($a,$b,$c).begininvoke() # run in background $a.EndInvoke($r1); $b.EndInvoke($r2); $c.EndInvoke($r3) # wait ($a,$b,$c).streams.error # check for errors ($a,$b,$c).dispose() # clean