@echo off setlocal :: 获取脚本所在目录 cd /d "%~dp0" :: 检查虚拟环境 if exist "venv\Scripts\activate.bat" ( echo Activating virtual environment... call venv\Scripts\activate.bat ) else ( echo Creating new virtual environment... python -m venv venv call venv\Scripts\activate.bat echo Installing dependencies... python -m pip install --upgrade pip pip install pyinstaller pip install PyQt5 pip install requests pip install urllib3 ) :: 执行打包 echo Starting build process... python -m PyInstaller ^ --name="TingquanHelper" ^ --onefile ^ --windowed ^ --clean ^ --noconfirm ^ --add-data="logger.py;." ^ --add-data="update_cursor_token.py;." ^ --add-data="cursor_auth_manager.py;." ^ --add-data="reset_machine.py;." ^ --add-data="patch_cursor_get_machine_id.py;." ^ --add-data="exit_cursor.py;." ^ --add-data="go_cursor_help.py;." ^ --add-data="logo.py;." ^ --hidden-import=PyQt5 ^ --hidden-import=requests ^ --hidden-import=urllib3 ^ gui/main_window.py :: 检查打包结果 if exist "dist\TingquanHelper.exe" ( echo Build successful! Executable created at dist\TingquanHelper.exe ) else ( echo Build failed. Please check the error messages. ) :: 退出虚拟环境 deactivate endlocal