I need to pause a powershell script until a process it started has finished. Great I can just use Start-Process xxxx -wait
But there are a few cases where I need to be able to continue the script without waiting, and I can't make this decision before I start the process.
Preferable I would even be able to kill the started process here, but is there a way to start a process and then listen for enter key or "continue" that will stop the process and let the powershell script continue on and otherwise just wait for the process to finish and exit to continue the script?
I've been digging through the powershell docs for a couple hours and I'm having a hard time finding what commands best handle my problem.
aside, ideally this would be powershell 7 (core) cross platform compatible.
$p = Start-Process -Passthruthen call$p. WaitForExit(2000)in a loop, and check the book result. If you need to kill the process call$p. Kill()- Moerwald