本文主要是介绍vs2013 批处理程序自动编译实例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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
这篇关于vs2013 批处理程序自动编译实例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!