title: Batch script to remove parentheses and spaces from all file names
body: <p>I have to manipulate dozens if not hundreds of images fairly often. When I get the images, it's often 1018u182012480d1j80.jpg type filenames, so I can select all of the images, and then hit 'F2' to rename them all to image (1).jpg | image (2).jpg | ... etc. Can someone write me a batch script to remove the parentheses and the spaces in the file names? </p>
  
  <p>If possible, it'd be great if I didn't even have to open it up and edit the batch file to update the current dir, I.E, if it can just use %CD% or something to get the current folder, that would be awesome.</p>
  
  <p>I don't understand batch files at all but here's one I found that will remove the parentheses, but I have to add the sourcedir. </p>
  
  <pre><code>@ECHO OFF
  SETLOCAL
  SET "sourcedir=C:\.." #Can we make this just find the location?
  FOR /f "delims=" %%a IN (
    'dir /b /s /a-d "%sourcedir%\*" '
   ) DO (
   SET "name=%%~na" 
   SETLOCAL ENABLEDELAYEDEXPANSION
   SET "newname=!name:)=!"
   SET "newname=!newname:(=!"
   IF "!name!" neq "!newname!" (
    IF EXIST "%%~dpa!newname!%%~xa" (ECHO cannot RENAME %%a
     ) ELSE (REN "%%a" "!newname!%%~xa")
  
   )
   endlocal
  )
  </code></pre>