title: Concatenating strings and variables in batch
body: <p>I would like to create a dynamic file path in <code>.bat</code> file. At the moment the file path looks like this:</p>
  
  <pre><code>"C:\FolderA\FolderB\FileA.xlsx"
  </code></pre>
  
  <p>I would like to incorporate today's date in the file name to produce something like that:</p>
  
  <pre><code>/exp:"C:\FolderA\FolderB\FileA " &amp; date() &amp; ".xlsx" /T`
  </code></pre>
  
  <p>I have tried creating a variable and concatenating it with the hard coded part but it does not work:</p>
  
  <pre><code>set Mydate=!date:~10,4!!date:~7,2!!date:~4,2!
  /exp:"C:\FolderA\FolderB\FileA "&amp;%Mydate%&amp;".xlsx" /T
  </code></pre>
  
  <p>What are the rules on concatenating characters and variables and on quotation marks in batch?
  How to debug in batch using Notepad?</p>