The following doesn’t work, because it doesn’t wait until the process is finished:
import subprocess p = subprocess.Popen('start /WAIT /B MOZILL~1.LNK', shell=True) p.wait()
Any idea how to run a shortcut and wait that the subprocess returns ?
Edit: originally I was trying this without the shell option in my post, which caused Popen to fail. In effect, start is not an executable but a shell command. This was fixed thanks to Jim.
You will need to invoke a shell to get the subprocess option to work:
This however will still exit immediately (see @R. Bemrose).
If
p.pidcontains the correct pid (I’m not sure on windows), then you could useos.waitpid()to wait for the program to exit. Otherwise you may need to use some win32 com magic.