import os
os.system('firefox.exe')
我把上面这段python 代码 编译成了exe ,启动firefox后,中间那个cmd.exe 会启动着,有什么办法隐藏这个cmd 窗口?
import os
os.system('firefox.exe')
我把上面这段python 代码 编译成了exe ,启动firefox后,中间那个cmd.exe 会启动着,有什么办法隐藏这个cmd 窗口?
testx1=subprocess.Popen(r"C:UserscoolVideosthunder_shortcut.lnk",shell=True)
time.sleep(1)#等待使子进程打开
testx1.kill()#关闭cmd窗口
2 回答5.2k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
4 回答1.4k 阅读✓ 已解决
3 回答1.3k 阅读✓ 已解决
3 回答1.3k 阅读✓ 已解决
2 回答892 阅读✓ 已解决
1 回答1.8k 阅读✓ 已解决
不使用 cmd.exe 就是了。
使用
subprocess.Popen
并且不要指定shell=True
。