subprocess弹出窗口去除

最近在用subprocess调用命令行的时候经常会遇到弹出黑框的问题,很令人讨厌。现记录下用去除黑框的方法:

import subprocess 
st=subprocess.STARTUPINFO
st.dwFlags=subprocess.STARTF_USESHOWWINDOW
st.wShowWindow=subprocess.SW_HIDE
s=subprocess.Popen("sc query mysql",startupinfo=st)
posted @ 2010-08-31 16:44  john2000  阅读(1120)  评论(0编辑  收藏  举报