PowerShell, Difference between Start-Job and a hidden Start-Process that calls powershell.exe

201 Views Asked by At

I can use Start-Job to run a process in the background for asynchronous / parallel jobs.

However, I could also use something like the following with Start-Process which gives me other options for an asynchronous background process.

$command = "choco install openoffice -y"
Start-Process "powershell.exe" -WindowStyle Hidden -ArgumentList "-sta -noprofile -executionpolicy unrestricted $command"

What are the pros and cons to using each method?

0

There are 0 best solutions below