Run a shortcut under windows

后端 未结 3 929
春和景丽
春和景丽 2021-01-03 15:22

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\',          


        
3条回答
  •  春和景丽
    2021-01-03 16:03

    Note: I am simply adding on Jim's reply, with a small trick. What about using 'WAIT' option for start?

    p = subprocess.Popen('start /B MOZILL~1.LNK /WAIT', shell=True)
    p.wait()
    

    This should work.

提交回复
热议问题