title: How to exclude file extension when using 7zip cmd line batch
body: <p>I have a .batch script in my Send to folder on Windows which I use to compress multiple files in the folder to a .zip. The problem I'm having is, it's including the extension in the archive file name.</p>
  
  <p>I've search on google, read a lot of posts on stackexchange etc and none of the solutions posted seem to work for me.</p>
  
  <pre><code>@echo off
  for %%A in (*.*) do call :doit "%%A"
  goto end
  
  :doit
  if "%~x1"==".bat" goto :eof
  if "%~x1"==".7z" goto :eof
  if "%~x1"==".zip" goto :eof
  if "%~x1"==".rar" goto :eof
  "C:\Program Files\7-Zip\7z.exe" a -tzip %1.zip %1 -sdel
  goto :eof
  
  :end
  </code></pre>
  
  <p>Myfile.txt -> MyFile.txt.zip</p>
  
  <p>I want to remove the .txt from file name if possible.</p>