windows下面自動打包exe批處理
阿新 • • 發佈:2019-02-11
@echo off
::flag to modify variables
setlocal enabledelayedexpansion
setlocal enableextensions
cd %~dp0
echo "Init Visual Studio Environment"
::call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
set BuildDir=%Temp%\SMELP_BUILD
set CoVer=HEAD
for /f "tokens=1,*" %%a in ('svn info http://10.59.97.221/svn/smel/trunk/smelp_client/smelp_client.sln' ) do (if "%%a" == "Revision:" set CoVer=%%b)
if NOT x%1x == xx (
set CoVer=%1
)
echo "svn cleanup"
"svn" cleanup ./
echo "Checking out SMELP on %BuildDir% at %CoVer%"
"svn.exe" co -r %CoVer% http://10.59.97.221/svn/smel/trunk/smelp_client "%BuildDir%"
echo "Retrieve SVN Revision"
set Revision=%CoVer%
echo "Building SMELP"
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" "%BuildDir%\smelp_client.sln" /Rebuild "Release|Win32"
::echo "Gen Version xml"
"%BuildDir%\Install\VersionGen.exe" 1.0.%Revision% "%BuildDir%\bin\Release"
echo "Packaging"
"%BuildDir%\Install\NSIS 2.51\NSIS\makensis.exe" "%BuildDir%\Install\nis_setup_script.nsi"
echo "Signing"
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\bin\signtool.exe" sign /v /f "%BuildDir%\Install\LoginBot.pfx" /p 000000 /tr http://timestamp.wosign.com/rfc3161 /d "小企業貸款" "%BuildDir%\Install\Setup_Smelp.exe"
echo "Artifact"
copy /Y "%BuildDir%\Install\Setup_Smelp.exe" .\Setup_Smelp-%Revision%.exe
pause