title: batch variable nested into a batch variable
body: <p>Depending on the text after 'X' and before 'Open file' in mypath variable, I want to call a function passing this text as argument in order to replace it by 'foo'. To do it, I have written</p>
  
  <pre><code>@echo off
  SET mypath=Y:\SUT\ISTQB\Board Airport\X\Dashboard\Open file
  if /i %1=="Dashboard" goto label %1
  if /i %1=="Dboard" goto label %1
  
  :label 
  SET mypath=%mypath:\%1\=foo%
  ECHO %mypath%
  </code></pre>
  
  <p>I notice that echoing mypath at the end of that script outputs</p>
  
  <pre><code>Y:\SUT\ISTQB\Board Airport\X\Dashboard\Open file  instead of 
  Y:\SUT\ISTQB\Board Airport\X\foo\Open file
  </code></pre>
  
  <p>I think of the issue is about parameter %1 within 'SET mypath=%mypath:\%1\=foo%', but I don't understand why.</p>
  
  <p>In fact I absolutely need to use parameter %1 because the text which is currently "Dashboard" into mypath variable is not a static text. It can be "Dboard", or anything</p>
  
  <p>Someone could explain me? Thank you in advance</p>