title: Windows Batch - Rename files with period before extension
body: <p>I'm on Windows 10, and I'm writing a batch file to convert many images from one format to another and renaming a helper file that generates more information about each image. Here's an example:</p>
  
  <pre><code>test.tif
  test.tif.thing
  </code></pre>
  
  <p>If I'm converting to a format like png, I want to rename <strong>test.tif.thing</strong> to <strong>test.png.thing</strong>. Here's the existing script I have, which doesn't work at all due to me experimenting with numerous options, but it should hopefully highlight the problem:</p>
  
  <pre><code>for %%q in (*.tif.thing) do (
      ren "%%q" "%%~pq%%~nq"
  )
  timeout 100
  </code></pre>
  
  <p>The main issue I'm having is removing the ".tif" when renaming the file, since ".thing" is technically the actual extension, so the filename is "thing.tif" without the extension. I looked into using variables to remove the characters from the string, but I never managed to get them to work, and if possible I'd like to know a cleaner solution to make this scale better should the filenames change in the future. How can I do this?</p>