Files
JoyD/AutoRobot/Windows/package.bat

60 lines
1.3 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
setlocal
echo ==============================================
echo 开始AutoRobot打包过程
echo ==============================================
:: 设置路径变量
set src_exe=e:\Download\AutoRobot\Windows\go_workspace\src\hello\hello.exe
set dest_exe=e:\Download\AutoRobot\Windows\hello.exe
set web_dir=e:\Download\AutoRobot\Windows\go_workspace\src\hello\Web
set zip_file=e:\Download\AutoRobot\Windows\AutoRobot.zip
:: 调试输出路径变量
echo 当前工作目录:%cd%
:: 检查源文件是否存在
if not exist %src_exe% (
echo 错误:源文件 %src_exe% 不存在
pause
exit /b 1
)
:: 检查Web目录是否存在
if not exist %web_dir% (
echo 错误Web目录 %web_dir% 不存在
pause
exit /b 1
)
:: 复制可执行文件
echo [1/2] 正在复制可执行文件...
copy /Y %src_exe% %dest_exe%
if %errorlevel% neq 0 (
echo 错误:文件复制失败
pause
exit /b 1
)
:: 创建压缩包
echo [2/2] 正在创建压缩包...
if exist %zip_file% (
echo 注意:已存在旧压缩包,将被替换
del /F /Q %zip_file%
)
powershell -Command "Compress-Archive -Path '%dest_exe%', '%web_dir%' -DestinationPath '%zip_file%' -Force"
if %errorlevel% equ 0 (
echo ==============================================
echo 打包成功!
echo 输出文件:%zip_file%
echo ==============================================
) else (
echo 错误:压缩失败
pause
exit /b 1
)
endlocal
pause