VS下批处理使用postBuild

项目中有时用到批处理操作

VS下批处理使用postBuild_第1张图片


其中为传入3个参数

bat文件中如下:

SET ProjectDir=%1
SET TargetDir=%2
SET /a BuildStyle=%3
CALL :copyFile CEF/lib/icudtl.dat
::BerBonSOUI.SOUI
ECHO 复制SOUI依赖库...
ECHO 参数为%BuildStyle%
if  %BuildStyle% EQU 0 (goto debugDll)
if  %BuildStyle% EQU 1 (goto releaseDll)
:debugDll
ECHO Copy debug dll
CALL :copyFile SOUI/dll/imgdecoder-gdipd.dll
EXIT
:releaseDll
ECHO Copy release dll
CALL :copyFile SOUI/dll/imgdecoder-gdip.dll
EXIT
:copyFile
SET filepath=%1
SET filename=%~n1%~x1
SET copyfrom=%ProjectDir%%filepath%
SET copyto=%TargetDir%%filename%
if not exist %copyto% (
echo 复制 %copyfrom% -> %copyto%
XCOPY "%copyfrom%" "%copyto%" /F /Y)

你可能感兴趣的:(Build,events批处理VS)