扫码关注官方订阅号
import os os.system('firefox.exe')
我把上面这段python 代码 编译成了exe ,启动firefox后,中间那个cmd.exe 会启动着,有什么办法隐藏这个cmd 窗口?
光阴似箭催人老,日月如移越少年。
不使用 cmd.exe 就是了。
使用subprocess.Popen并且不要指定shell=True。
subprocess.Popen
shell=True
testx1=subprocess.Popen(r"C:UserscoolVideosthunder_shortcut.lnk",shell=True)time.sleep(1)#等待使子进程打开testx1.kill()#关闭cmd窗口
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
不使用 cmd.exe 就是了。
使用
subprocess.Popen
并且不要指定shell=True
。testx1=subprocess.Popen(r"C:UserscoolVideosthunder_shortcut.lnk",shell=True)
time.sleep(1)#等待使子进程打开
testx1.kill()#关闭cmd窗口