python subprocess popen 静默模式(不弹出console控制台)

时间:2023-03-08 17:50:39
python subprocess popen 静默模式(不弹出console控制台)

python subprocess popen 静默模式(不弹出console控制台)

import subprocess,sys

IS_WIN32 = 'win32' in str(sys.platform).lower()

if IS_WIN32:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE |
subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
p = subprocess.popen([],startupinfo = startupinfo)

参考链接:https://blog.csdn.net/ztb3214/article/details/19256849?utm_source=blogxgwz9