title: rename multiple files using substring of the filename
body: <p>I have 100's of file in windows with names like</p>
  
  <pre><code>W-cat_T_1001_s.jpg
  W-dog_T_12112_o.jpg
  W-rabbit_T_121_w.jpg
  </code></pre>
  
  <p>i want to rename all the files to its substring for example</p>
  
  <pre><code>cat.jpg
  dog.jpg 
  rabbit.jpg
  </code></pre>
  
  <p>My approach was to first replace <code>"_T_*"</code> with "" in powerShell something like</p>
  
  <pre><code>DIR| Rename-Item -NewName {$_.Name -replace "_T_*", ""}
  </code></pre>
  
  <p>this gives error</p>
  
  <pre><code>Rename-Item : Cannot rename because item at 'z' does not exist
  </code></pre>
  
  <p>i don't know whether it was a right approach and whether it is good to use PowerShell, batch file, java or simple "rename" command will do.</p>