配合Jenkins自動化構建,bat腳本(二)


 批量通過模板,拷貝文件,然后替換模板文件中的標記位為預制的內容。

1
Set servicePath=Ehong.MedicareReview.Web\地區配置\ 2 Set webPath=Ehong.MedicareReview.Web\ 3 Set current=%~dp0 4 5 rem 1.創建審核的配置文件 6 Set targetPath=%current%%servicePath%%targetArea% 7 rd /s /q "%targetPath%" 8 mkdir "%targetPath%" 9 10 echo f | xcopy /y "replace.bat" "%current%%webPath%\replace.bat" 11 12 rem 2.進入目錄 13 cd "%webPath%" 14 15 rem 3.拷貝文件並重命名 16 echo f | xcopy /y "settings_debug_%fadebackmodel%.xml" "temp0.xml" 17 start replace.bat 18 19 :11 20 if not exist succeed.txt goto :11 21 22 echo f | xcopy "temp1.xml" "%targetPath%/settings.xml" 23 echo f | xcopy "temp1.xml" "%targetPath%/settings_debug.xml" 24 rem 4.svn附加文件 25 svn add "%targetPath%" --username wangzhen --password wz123 26 27 if exist temp0.xml del temp0.xml 2>nul 28 if exist temp1.xml del temp1.xml 2>nul 29 if exist succeed.txt del succeed.txt 2>nul 30 if exist replace.bat del replace.bat 2>nul 31 32 exit

以上 拷貝需要的文件


 

 

 1 chcp 65001
 2 @echo off & if exist temp1.config del temp1.config 2>nul
 3 for /f "tokens=*" %%i in (temp0.config) do (
 4     setlocal disabledelayedexpansion 
 5     endlocal
 6     if "%%i"=="" (echo.) else (    
 7     set "line=%%i" 
 8     setlocal enabledelayedexpansion
 9     call :chg
10     endlocal
11     )
12 ) 
13 echo succeed>>succeed.txt
14 exit
15 
16 :chg
17 set "line=!line:DevelopArea=%targetArea%!"
18 echo !line!>>temp1.config
19 goto :eof

以上替換文件中的內容

 


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM