How to replace Strings in Windows Batch file

前端 未结 4 556
误落风尘
误落风尘 2020-12-22 08:20

I would like to replace the following String in a file:

android:versionName=\"anyStringHere\" >

*anyStringHere represents any possible s

4条回答
  •  佛祖请我去吃肉
    2020-12-22 09:00

    I found that using sed was the cleanest solution

    http://gnuwin32.sourceforge.net/packages/sed.htm

    sed "s/android:versionName=\".*\" >/android:versionName=\"%NEW_VERSION%\" >/g" %ORIG_FILE_NAME% > %TEMP_FILE_NAME%
    
    @move /Y %TEMP_FILE_NAME% %ORIG_FILE_NAME% >nul
    

提交回复
热议问题