title: Batch File Replace/Rename
body: <p>I am looking to rename a bunch of files in a directory with a batch file.  I want to do this:</p>
  
  <p>file_XX_img.tiff to file_32_img.tiff</p>
  
  <p>I have this code</p>
  
  <pre><code>@echo off
  SETLOCAL ENABLEDELAYEDEXPANSION
  
  set fName=%1
  if '%1' equ '' set /p fName=Enter file name:
  
  
  for /f "delims==" %%F in ('dir /b *.aaa') do ren "%%~nxF" "%%~nF"
  
  pause
  </code></pre>
  
  <p>that renames the extension but I want to convert it so I can replace the XX with a number.  How do I modify it to work for this situation?</p>
  
  <p>----------------------------------EDIT---------------------------------------------</p>
  
  <p>figured it out:</p>
  
  <pre><code>@echo off
  SETLOCAL ENABLEDELAYEDEXPANSION
  set fName=%1
  set /p vers=Enter Vers:
  for /f "delims==" %%F in ('dir /b file_XX*.*') do ren "%%~nxF" "file_%vers%*.*"
  pause
  </code></pre>