Jenkins之前置替换脚本内容

Posted 星瑞的随笔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jenkins之前置替换脚本内容相关的知识,希望对你有一定的参考价值。

Pre Steps Windows batch script

@echo off

CHCP 65001

setlocal enabledelayedexpansion

set file=src/test/java/org/weshare/sx/test/SXTest.java

set "file=%file:"=%"

for %%i in ("%file%") do set file=%%~fi

set replaced=src/test/resources/授信脚本

set all=src/test/resources/授信脚本/QmlxrTest

for /f "delims=" %%i in (type "%file%") do (

   set str=%%i

   set "str=!str:%replaced%=%all%!"

   echo !str!>>"%file%"_tmp.txt

)

copy "%file%" "%file%"_bak.txt >nul 2>nul

move "%file%"_tmp.txt "%file%"

start "" "%file%"

 

以上是关于Jenkins之前置替换脚本内容的主要内容,如果未能解决你的问题,请参考以下文章