title: store yesterdays date in yyyymmdd format into a variable
body: <p>I have a file by the name yyyymmddFile1.txt where date prefix is added in a particular format.</p>
  
  <p>I need to copy that file from one location to another and I need to pick today's and yesterday's file</p>
  
  <p>For today, I wrote</p>
  
  <pre><code>SET TODAY=%date:~10,4%%date:~4,2%%date:~7,2%
  
  SET MAINPATH=D:\%TODAY%File1.txt
  if exist %MAINPATH% (
  COPY D:\%TODAY%File1.txt D:\NDM\InFileQueue\%TODAY%File1.txt
  )
  </code></pre>
  
  <p>so, This will set the filename to 20190502File1.txt</p>
  
  <p>But I can't figure out how to pass yesterday's date as a variable. I need to do something like this - </p>
  
  <pre><code>SET YESTERDAY= ??
  
  SET MAINPATH=D:\%YESTERDAY%File1.txt
  if exist %MAINPATH% (
  COPY D:\%YESTERDAY%File1.txt D:\NDM\InFileQueue\%YESTERDAY%File1.txt
  )
  </code></pre>