Make Foreground a Backgrounded Job invoked by Start-Job in Powershell for Windows
I've been burning the midnight oil and banging my head up against Google search after Google search. It turns out this is pretty easy using invoke-item.
Here is how I'm using it:
invoke-item .\form.ps1timeout /t 90wmic Path win32_process Where "CommandLine Like '%form.ps1%'" Call Terminate
This will call my script form.ps1
(a Windows form that I created) from within PowerShell. The Parent will continue to execute while form.ps1
is running.
I'm using
wmic Path win32_process Where "CommandLine Like '%form.ps1%'" Call Terminate
to kill the form by its command line name.