title: Batch 7-zip compression excluding some files FOR %%i IN (*.*)
body: <p>I have this code which I found online from another post using 7-zip I would like to zip all the files in the current folder (if sub folders can be added that would be even better). currently it works, but I would like to exclude files which have already been zipped / compressed (ex: .rar, .zip).</p>
  
  <p>Is there some syntax that can exclude this for me, i.e. exclude a particular extension? Also I can not go the other way around of zipping the extensions that I want because I do not know what I will encounter.</p>
  
  <p>This works zipping all files:</p>
  
  <pre><code>FOR %%i IN (*.*) DO "c:\Program Files\7-Zip\7z.exe" a "%%~ni.7z" "%%i" -mx=9 -ms=on -md=32m -mfb=256
  </code></pre>
  
  <p>I need something like:</p>
  
  <pre><code>FOR %%i IN (*.*, *NOT(.zip), NOT(.rar)*) DO "c:\Program Files\7-Zip\7z.exe" a "%%~ni.7z" "%%i" -mx=9 -ms=on -md=32m -mfb=256
  </code></pre>
  
  <p>Answer:
  Since both solutions offered by @Aacini and @IZB are useful I can not pick either one of them to be the best, as they both are effective.</p>