Consider the following code:
start-job -scriptblock { sleep 10; cmd /c set > c:\\env.txt; } exit
The background job is killed when the p
You will have to start a process:
start-process powershell -ArgumentList "sleep 10; cmd /c set > c:\env.txt" -WindowStyle hidden