title: DOS batch - Print names of files (exclude certain extensions)
body: <p>The question is about actual DOS batch files, not Windows <code>cmd.exe</code> script files.</p>
  
  <p>How do I exclude files with specific extensions from being processed in a <code>for</code> loop?</p>
  
  <pre><code>@echo off
  
  set myExtension=
  
  for /r C:\ %%i in (*) do (
      ::notDesirableExtension
      if myExtension != gif or jpg
          ...
      echo myFiles &gt;&gt; F:\list.txt
  ) 
  </code></pre>