zoukankan      html  css  js  c++  java
  • 配合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% eplace.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

    以上替换文件中的内容


  • 相关阅读:
    一个强大的json解析工具类
    android存储路径问题
    android界面的滑动切换功能
    mysql数据库
    【hadoop+spark】搭建spark过程
    【设计模式】行为型01策略模式(strategy patten)
    【java爬虫】网络爬虫思路
    maven_nexus私服搭建
    【需要重新维护】Redis笔记20170811视频
    【工具】java 文本文档txt写出记录工具
  • 原文地址:https://www.cnblogs.com/wzalex/p/5190851.html
Copyright © 2011-2022 走看看