title: Convert string to integer on Windows Batch
body: <p>I've been searching a lot about how to convert a string into a integer on windows batch but I just can't get how to do it.</p>
  
  <p>I've written a batch that copies a file from a directory to another and name it after the current date. My code goes something like this:</p>
  
  <p><code>set FILE=log %date:~6,4%-%date:~3,2%-%date:~0,2%
  copy C:\log.txt C:\"%FILE%".txt</code></p>
  
  <p>I need to do the conversion to make FILE be one day previous.
  For example, if I run the script right now, I'll get a file named "log 2014-07-09", but I want it to be "log 2014-07-08".</p>
  
  <p>I've tried with this few sentences but I get an error about the numeric value is not valid:</p>
  
  <pre><code>set DAY=%date:~0,2% :: this assignation give me no problems
  set /A DAY = %DAY%-1 :: this is the one that makes my head breaks
  </code></pre>
  
  <p>I don't know where the error is because I barely know windows batch sentences. I've read about the SET command syntax at Help command and other sites (like <a href="http://www.robvanderwoude.com/ntset.php" rel="nofollow">this</a> one) but I can't get where I'm failing. I know this may be very simple (on some programming languages a Parse sentence would be enough), but I'm a total novice on this batch script stuff, so any help will be much appreciated. :)</p>