Earlier this week I had a need to start a process from PowerShell and ensure that it did not take focus. This doesn’t seem to be supported by the Start-Process cmdlet or any other mechanism built into PowerShell, so I quickly built this script to call into CreateProcess with SW_SHOWNOACTIVATE. With the below function a process can be started without it stealing focus, though it will appear on top of the z-order.
↧