title: Batch Script to Update text in the properties file
body: <p>I have a question regarding the batch.</p>
  
  <p>I have a properties file in Directory. Which has a text "BuildNumber=0". I want to replace this "BuildNumber=0" with "BuildNumber=%BUILD_NUMBER%". I am using the following script to achieve this</p>
  
  <pre><code>@echo on
  setlocal enabledelayedexpansion enableextensions
  
  
  ATTRIB -r -s C:\bldarea\myfile\..\..\jenkinstest\abc.properties
  
  CD C:\bldarea\myfile\file\Main_Releases\jenkinstest\
  call :FindReplace "Buildnumber=0" "Buildnumber=%BUILD_NUMBER%" abc.properties
  exit /b 
  
  :FindReplace &lt;Buildnumber=0&gt; &lt;Buildnumber=%BUILD_NUMBER%&gt; &lt;abc.properties&gt;
  set tmp="%temp%\tmp.txt"
  If not exist %temp%\_.vbs call :MakeReplace
  for /f "tokens=*" %%a in ('dir "%3" /s /b /a-d /on') do (
  for /f "usebackq" %%b in (`Findstr /mic:"%~1" "%%a"`) do (
  echo(&amp;Echo Replacing "%~1" with "%~2" in file %%~nxa
  &lt;%%a cscript //nologo %temp%\_.vbs "%~1" "%~2"&gt;%tmp%
  if exist %tmp% move /Y %tmp% "%%~dpnxa"&gt;nul
  )
  )
  del %temp%\_.vbs
  exit /b
  
  :MakeReplace
  &gt;%temp%\_.vbs echo with Wscript
  &gt;&gt;%temp%\_.vbs echo set args=.arguments
  &gt;&gt;%temp%\_.vbs echo .StdOut.Write _
  &gt;&gt;%temp%\_.vbs echo Replace(.StdIn.ReadAll,args(0),args(1),1,-1,1)
  &gt;&gt;%temp%\_.vbs echo end with
  </code></pre>
  
  <p>The problem with this script is , It is  not converting BuildNumber=0 to current Build Number.</p>
  
  <p>From the line in code:</p>
  
  <pre><code>:FindReplace &lt;Buildnumber=0&gt; &lt;Buildnumber=%BUILD_NUMBER%&gt; &lt;abc.properties&gt;
  </code></pre>
  
  <p>if I remove % symbol then it is printing the "BuildNumber=%BUILD_NUMBER%" but the "BuildNumber=0" is still present in the doc. Can someone please help me out to replace the text correctly.</p>
  
  <p>Thanks.</p>