title: Replace substrings from a string
body: <p>I am new to Batch scripting and have searched all the material available but I did not get a satisfactory answer.</p>
  
  <p>I have a string called <strong>find_str</strong> which has the following content </p>
  
  <blockquote>
    <p>baseUrl:{development:"<a href="https://myserver.example:1234" rel="nofollow noreferrer">https://myserver.example:1234</a>"}</p>
  </blockquote>
  
  <p>I want to replace the url given in development with <a href="http://localhost:8084" rel="nofollow noreferrer">http://localhost:8084</a></p>
  
  <p>So the output should look like </p>
  
  <blockquote>
    <p>baseUrl:{development:"<a href="http://localhost:8084" rel="nofollow noreferrer">http://localhost:8084</a>"}</p>
  </blockquote>
  
  <p>I have a variable called</p>
  
  <p>find_string which has <a href="https://myserver.example:1234" rel="nofollow noreferrer">https://myserver.example:1234</a> and a variable called </p>
  
  <p>replacestr which has <a href="http://localhost:8084" rel="nofollow noreferrer">http://localhost:8084</a></p>
  
  <p>I have referred to this site <a href="http://www.dostips.com/DtTipsStringManipulation.php#Snippets.Replace" rel="nofollow noreferrer">Replace a substring using string substitution</a></p>
  
  <p>But there the string to be replaced is hardcoded , I want the string to be replaced to come from the variables given above and want to store the entire result in a third variable.</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>setlocal ENABLEDELAYEDEXPANSION
  For /F "tokens=1* delims==" %%A IN (environment.properties) DO (
      IF "%%A"=="url" set replacestr=%%B
  )
  
  set /p find_str=&lt;%~dp0application\app\common\common.config.js
  
  set cmd="echo %find_str:~92,37%"
  
  FOR /F "tokens=*" %%i IN (' %cmd% ') DO SET find_string=%%i
  
  echo !find_string!
  
  echo !replacestr!
  
  break&gt;%~dp0portfolio-analyzer\app\common\common.config.js
  set _result=%find_str:=!replacestr!%
  
  &gt;&gt; %~dp0portfolio-analyzer\app\common\common.config.js echo %_result%
  
  pause
  </code></pre>
  
  <p>But it is not replacing the find_str with its value.</p>
  
  <p>Thanks in advance.</p>