PowerShell will wait until the Notepad.exe process has been exited before continuing. That is nifty but kind of subtle to pick up from reading the code. You can also use Start-Process with the -Wait parameter:
What is difference between wait and sleep? Note that sleep and wait can be very powerful in conjunction, if you want your bash script to wait until it receives a signal. The following script will stop waiting for the sleep to finish if it receives one of the trapped signals. With just the sleep alone, the signal wouldn't be encountered until the sleep has finished.
Newsweek on MSN: Social Security Update: Seniors Will Wait Longer for Benefits Next Month
MSN: 10 dogs that will wait by the door until you come back
10 dogs that will wait by the door until you come back
Crude Oil Prices: Powell: Fed Will 'Wait and See' Before Pulling Interest Rate Trigger
Federal Reserve Chair Jerome Powell on Monday said that U.S. monetary policy is in a good place, and the Fed will wait and see how the ongoing Middle East conflict will impact the economy and ...
What is the difference between a wait() and sleep() in Threads? Is my understanding that a wait() -ing Thread is still in running mode and uses CPU cycles but a sleep() -ing does not consume any CPU cycles correct? Why do we have both wait() and sleep()? How does their implementation vary at a lower level?
Difference between "wait ()" vs "sleep ()" in Java - Stack Overflow