<P>为了测试和个人的概念证明,我有一个.exe文件,它只输出一个简单的字符串,然后调用系统停顿(字面上的^ {< CD1>}在C++中)。在</p>
<p>我有一个简单的Python脚本,我正在一个Windows XP虚拟机上测试,当出现问题时,它会执行以下操作:</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 c:\blank.txt:ads.exe', shell=True)
subprocess.call(r'del c:\blank.txt', shell=True)
</code></pre>
<p>显然,这些命令在命令行上都能很好地工作,为什么它们在通过Python调用时不能正常工作呢?在</p>
<p>我收到以下弹出错误消息:</p>
<blockquote>
<p>blank.txt:ads.exe has encountered a
problem and needs to close. We are
sorry for the inconvenience.</p>
<p>If you were in the middle of
something, the information you were
working on might be lost.</p>
</blockquote>
<p>文件确实也被删除了。似乎系统暂停被delete命令压碎了,当我希望.exe弹出时,等我按enter键,然后脚本将继续并删除文件。在</p>