Run a shortcut under windows

后端 未结 3 913
春和景丽
春和景丽 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

    cmd.exe is terminating as soon as start launches the program. This behavior is documented (in start /? ):

    If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:

    ...

    When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing within a command script.

    How this is affected by the /wait flag, I'm not sure.

提交回复
热议问题