start new instance of process after last one terminates

My goal is to monitor notepad process. If existing instance is closed then new one should start. I have following code (this is simplified snippet from my larger code base where I use WinForms): function ShowRunningPids() { foreach ($proc in $startedProcesses){ Write-Host (“`$proc.Id: {0}” -f $proc.Id) } } function CheckPids($procPid) { Write-Host “Already started PIDS:”…

Details