python 快速打包脚本

73 阅读1分钟
@echo off
rem 修改为自己pyinstaller.exe的路径
set "EXECUTABLE=D:\python\local_env\Scripts\pyinstaller.exe"
echo %EXECUTABLE%
 
set "doc_dir_withfilename=%1"
echo 文件位置 %doc_dir_withfilename%
 
set "filename=%~nx1"
echo 文件名%filename%
 
set "endwith= %~x1"
echo 文件后缀%endwith%
 
set "NOWPATH=%~dp1"
echo 文件路径 %NOWPATH%
cd %NOWPATH%
echo 当前路径 %cd%
 
if exist "%EXECUTABLE%" (
     if "%endwith%" == " .py" (
        echo python文件
        CALL %EXECUTABLE% -F -w %filename%
    )else (
        echo 不是python 
         
    )
)else (
     echo "检查pyinstaller.exe路径是否正确"
)
  
pause