::7zSFX模块单文件打包
@echo off

::设置主要程序名
set MyProductName=FastCopy
::设置版本号
set MyVersionInfo=5,7,5,0
::设置输出文件名
set OutFileName=FastCopy_5.7.5.0_7zSFX.exe



::压缩软件包
Bin\7z\7z.exe a -t7z Bin\Temp\%MyProductName%.7z .\%MyProductName%\* -mx -mmt -myx
::提取素材
copy /y "Bin\7zSFX\7zsd_All_171_3901.sfx" "Bin\Temp\7zsd.sfx"
copy /y "Bin\VersionInfo.rc" "Bin\Temp\VersionInfo.rc"
Bin\fnr\fnr.exe --cl --dir "Bin\Temp" --fileMask "*.rc" --find "MyProductName" --replace "%MyProductName%"
Bin\fnr\fnr.exe --cl --dir "Bin\Temp" --fileMask "*.rc" --find "MyVersionInfo" --replace "%MyVersionInfo%"
Bin\ResourceHacker\ResourceHacker.exe -open Bin\Temp\VersionInfo.rc -save Bin\Temp\%MyProductName%.res -action compile
::添加图标和版本号
Bin\ResourceHacker\ResourceHacker.exe -open Bin\Temp\7zsd.sfx -save Bin\Temp\7zsd_ico.sfx -action addoverwrite -res %MyProductName%.ico -mask ICONGROUP,101,
Bin\ResourceHacker\ResourceHacker.exe -open Bin\Temp\7zsd_ico.sfx -save Bin\Temp\7zsd_C.sfx -action delete -mask VERSIONINFO,,
Bin\ResourceHacker\ResourceHacker.exe -open Bin\Temp\7zsd_C.sfx -save Bin\Temp\7zsd_OK.sfx -action addoverwrite -res Bin\Temp\%MyProductName%.res -mask VERSIONINFO,,
::生成单文件
copy /b Bin\Temp\7zsd_OK.sfx + %MyProductName%.txt + Bin\Temp\%MyProductName%.7z %OutFileName%

::清理临时文件
del /f /q "Bin\Temp\*.*"
del /f /q "Bin\ResourceHacker\ResourceHacker.ini"

echo.
echo.
echo.&echo 打包完成 &timeout /t 3 >nul&exit








