windows 系统 python 隐藏cmd 控制台窗口

使用bat文件

@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~0"" h",0)(window.close)&&exit
:begin
:: 关闭cmd控制台
lsrunase /user:Administrator /password:123456 /domain:test /command:"C:\Python37\pythonw.exe D:\xxx.py" /runpath:"%homepath%\desktop"
:: 管理员权限执行程序,防止代码内的权限不足
:: 使用 pythonw.exe D:\xxx.py  python不会显示控制台窗口,相当于以后台运行的模式

pyinstaller 打包py文件为exe

https://www.cnblogs.com/yaodun55/p/16011516.html

posted @ 2023-01-12 13:12  mmszxc  阅读(571)  评论(0)    收藏  举报