vs2013 批处理程序自动编译实例

来源:互联网 发布:h5活动报名系统源码 编辑:程序博客网 时间:2024/06/05 19:37

1、编译release实例脚本如下:

@echo off
set debugOrRelease=Release
set baseOutPath=%debugOrRelease%


rem 当前脚本所在路径
set build_root = %~dp0
 
rem vcvarsall.bat所在的路径:
set vcvars="%VS120COMNTOOLS%../../VC/vcvarsall.bat"
set devenv="%VS120COMNTOOLS%../IDE/devenv.exe"


rem 设置解决方案的路径
set thesln=./test.sln


echo 开始编译 
echo on 


echo 正在编译,请稍后...
@%devenv% %thesln% /rebuild %baseOutPath% /out build.log
@endlocal
@notepad build.log


@PAUSE

注意:bat文件与.sln文件在同一文件夹下;若需要编译其他的debug,则只需要修改set debugOrRelease=Release即可。


2、以上脚本参考如下:

@echo off
set debugOrRelease=debug
set baseOutPath=..\09.临时版本\Circus\%debugOrRelease%
set driverOutPath=%baseOutPath%\Config
set catPath=%driverOutPath%\Cat
set dogPath=%driverOutPath%\Dog


set CircusInPath=Circus\bin\%debugOrRelease%
set catInPath=Cat\bin\%debugOrRelease%
set dogInPath=Dog\bin\%debugOrRelease%


echo 输出路径
echo.%driverOutPath%
echo.%catPath%
echo.%dogPath%


@PAUSE 
echo 开始编译 
%windir%\microsoft.net\framework\v4.0.30319\msbuild  Circus.sln /p:Configuration=%debugOrRelease% /t:Rebuild


@PAUSE
echo 开始复制
if not exist %catPath% md  %catPath%
if not exist %dogPath% md  %catPath%


echo  复制Circus
xcopy %CircusInPath% %baseOutPath%  /S /Y


echo  复制Cat
copy  %catInPath%\Cat.dll %catPath%   /Y


echo 复制Dog
xcopy %dogInPath% %dogPath%  /S /Y


echo 复制完毕
@PAUSE




原创粉丝点击