title: use batch scripting and 7-zip to compress files
body: <p>I have a folder composed of files :</p>
  
  <p>"1.txt"<br>
  "2.txt"</p>
  
  <p>I need to compress them in a zip thanks to 7-zip via a batch file.
  Everything is working well with this script :</p>
  
  <pre><code>7za a my_zip.rar 1.txt 2.txt 
  </code></pre>
  
  <p>I get a my_zip.rar containing the two files.</p>
  
  <p>The problem is that I need to name the zip file with the date at the time the batch file is executed. So I tried this script :</p>
  
  <pre><code>set year=%date:~10,4%
  set month=%date:~4,2%
  
  7za a %year%_%month%.rar 1.txt 2.txt 
  </code></pre>
  
  <p>I am getting a folder called "_2" containing a ".rar" containing my 2 files.
  I would like to have a "2014_12.rar" file containing my 2 files.</p>
  
  <p>EDIT : Script output :</p>
  
  <pre><code>D:\Users&gt;zip.bat
  D:\Users&gt;set year=
  D:\Users&gt;set month=2/
  D:\Users&gt;echo _2/.rar 1.txt 2.txt
   _2/.rar 1.txt 2.txt
  D:\Users&gt;7za a _2/.rar 1.txt 2.txt
  7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
  Scanning
  Updating archive _2/.rar
  Compressing  1.txt
  Compressing  2.txt
  Everything is Ok
  </code></pre>
  
  <p>My zip.bat used :</p>
  
  <pre><code>set year=%date:~10,4%
  set month=%date:~4,2%
  echo %year%_%month%.rar 1.txt 2.txt
  7za a %year%_%month%.rar 1.txt 2.txt 
  </code></pre>
  
  <p>Thanks in advance for your help</p>