添加无控制台启动器以隐藏控制台窗口
Some checks failed
Docker Build and Push / check-secrets (push) Successful in 4s
Docker Build and Push / build-and-push (cpu, latest) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 11.8) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.6) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.8) (push) Has been skipped
Docker Build and Push / build-and-push (directml, latest) (push) Has been skipped
Build Windows CPU / build (push) Has been cancelled
Build Windows CUDA 11.8 / build (push) Has been cancelled
Build Windows CUDA 12.6 / build (push) Has been cancelled
Build Windows CUDA 12.8 / build (push) Has been cancelled
Build Windows DirectML / build (push) Has been cancelled

- 创建VBScript启动器(隐藏控制台启动.vbs)
- 创建BAT启动器备选方案(启动程序.bat)
- 添加详细使用说明(隐藏控制台窗口说明.txt)
- 保持console=True确保程序稳定运行
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yaofanguk
2026-04-10 22:00:25 +08:00
parent 41da4af03f
commit 774940e39b
3 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
@echo off
start /B VideoSubtitleRemover.exe

View File

@@ -0,0 +1,2 @@
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & WScript.ScriptFullName & "\..\VideoSubtitleRemover.exe" & chr(34), 0, False

View File

@@ -0,0 +1,55 @@
隐藏控制台窗口的方法
===================
由于某些库OpenCV、PaddlePaddle等在初始化时会创建控制台窗口
即使在 PyInstaller 中设置 console=False 也无法完全避免。
推荐解决方案:创建无窗口快捷方式
==============================
方法一:使用 VBScript 启动器(最可靠)
--------------------------------------
创建文件:隐藏控制台启动.vbs
内容:
```
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & WScript.ScriptFullName & "\..\VideoSubtitleRemover.exe" & chr(34), 0, False
```
保存到 dist/VideoSubtitleRemover/ 目录,双击此 vbs 文件即可启动。
方法二:修改现有快捷方式
--------------------------------------
1. 找到 VideoSubtitleRemover.exe右键点击
2. 选择"发送到" → "桌面快捷方式"
3. 在桌面找到创建的快捷方式,右键点击 → "属性"
4. 找到"目标"字段,在路径前添加:
``wscript.exe "隐藏控制台启动.vbs" /B //Nologo``
例如:
原目标C:\path\to\VideoSubtitleRemover.exe
新目标wscript.exe "C:\path\to\隐藏控制台启动.vbs" /B //Nologo "C:\path\to\VideoSubtitleRemover.exe"
方法三:直接使用 start 命令
--------------------------------------
创建文件:启动.bat
内容:
```
@echo off
start /B VideoSubtitleRemover.exe
```
双击此 bat 文件可以最小化控制台窗口的效果。
技术说明
========
当前版本使用 console=True 模式打包,确保程序稳定运行。
控制台窗口虽然会显示,但不影响程序功能。
如需完全隐藏控制台窗口,请使用上述方法之一。