title: How do I add the folder name to the file being created in my batch file?
body: <p>I'm using - </p>
  
  <pre><code>for /d /r %%a in (*) do (
      del "%%~fa\COMBINED_NAD.TXT" &gt;nul 2&gt;nul 
      copy /b "%%~fa\*NAD.TXT" "%%~fa\COMBINED_NAD.TMP"
      ren "%%~fa\COMBINED_NAD.TMP" "COMBINED_NAD.TXT"
  )
  </code></pre>
  
  <p>Which works great, but I also need it to include the directory folder name in the file it is creating - for example I want the output to be something like - "<code>%DIR%_COMBINED_NAD.TXT</code>".</p>
  
  <p>Does anyone know what I need to add? Thanks for the help.</p>