擅长:python、mysql、java
<p>结果是每个<code>subprocess.call(..., shell=True)</code>都会立即返回,因为它们只是告诉shell执行一个命令。在命令行上,调用一个使用<code>start</code>命令运行的exe仍将立即返回,即使exe尚未终止。<code>start</code>立即返回,需要通知它等待:</p>
<pre><code>subprocess.call(r'echo Nothing special. > c:\blank.txt', shell=True)
subprocess.call(r'type pause.exe > c:\blank.txt:ads.exe', shell=True)
subprocess.call(r'start /wait c:\blank.txt:ads.exe', shell=True)
subprocess.call(r'del c:\blank.txt', shell=True)
</code></pre>