title: Why does the batch file not concatenate two files to a new file?
body: <p>This is a very basic batch script. It is my first day of dealing with this topic.</p>
  <p>I want to create a script which takes a directory name and an extension as parameters, and if that directory exists, the contents of each file with that extension will be written into another file.</p>
  <p>Example:</p>
  <pre><code>scripts (DIR)
     |
     -----&gt;myFirstBatch.bat
     -----&gt;scripts2 (DIR)
           |
           -----&gt;test.xyz, test2.xyz, concat.txt
  </code></pre>
  <p>Let's say my batch script is called <code>myFirstBatch.bat</code>.</p>
  <p>I will run it like this:</p>
  <pre><code>myFirstBatch scripts2 .xyz
  </code></pre>
  <p>I expect <code>concat.txt</code> to have the contents of <code>test.xyz</code> and <code>test2.xyz</code>.</p>
  <p>Here's my script:</p>
  <pre><code>set var=%2
  shift
  if exist %0 (
  type .\%0\*%var%&gt;&gt;concat.txt
  )
  </code></pre>
  <p>But there is nothing inside <code>concat.txt</code>.</p>
  <p>What am I doing wrong?</p>