使用bat编译VS项目并复制其文件

使用bat编译VS项目并复制其文件(重命名)

@echo 初始化环境
 
@set OldPath=%cd%
 
::x86_amd64的路径要自己找
 
@cd /d C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build
 
@if not %errorlevel% == 0 goto :end
 
 
 
call vcvarsamd64_x86.bat
 
@if not %errorlevel% == 0 goto :end
 
 
 
cd /d %OldPath%
 
@if not %errorlevel% == 0 goto :end
 
 
 
@echo 清理项目
 
devenv test1.sln /Clean
 
@if not %errorlevel% == 0 goto :errBuild
 
 
 
@echo 开始编译
 
devenv test1.sln /ReBuild "Debug|x64"
 
@if not %errorlevel% == 0 goto :errBuild
 
 
 
devenv test1.sln /ReBuild "Release|x64"
 
@if not %errorlevel% == 0 goto :errBuild
 
 
rem 复制文件
@rem 头文件
setlocal enabledelayedexpansion
rem  以时间为文件名
set yyyymmdd=%date:~0,4%-%date:~5,2%-%date:~8,2%$%time:~0,2%-%time:~3,2%-%time:~6,2%
copy /y "C:\TT\Demo\C_C++\test1\x64\Debug\test1.exe" "C:\TT\Demo\public\!yyyymmdd!.exe"
::如果需要拷贝文件就看下copy命令
 
::如果需要删除文件就看下del命令
 
@echo 同步完成
 
@pause
 
goto :end
 
@pause
 
:errBuild
 
@echo 编译项目出错
 
@pause
 
:end

参考:
https://blog.csdn.net/lushangqiushui/article/details/89016556

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值