title: Batch Rename by Replace substring
body: <p>Hello :) when a friend give you a mp3 file, most often, the title is named that way: "avenged_sevenfold_-_buried_alive.mp3". i want to make a script which permit me to rename every file and folder of current repertoryby replacing "_" by " "(space). this is very long to rename each file manually; my script is here:</p>
  
  <pre><code>@echo off
  title Merci qui ?
  :debut
  echo do you want to rename every files/foldes by replacing "_" by " "? (y/n)
  set /p choix=
  
  
  if %choix%==y (
  goto renomage)
  
  if %choix%==n (
  goto end)
  
  goto debut
  
  :renomage
  
  set /a x=1 :pointeur de fichier
  
  set /a compteurA=0
  set /a compteurB=0
  for /f %%a in ('dir /b /a:-d *.*') do set /a compteurA+=1   
  for /f %%a in ('dir /b /a:d *.*') do set /a compteurB+=1
  echo %compteurA% fichiers %compteurB% dossiers
  set /a n=compteurA+compteurB
  
  echo number of folder/files batch included %n%
  
  
  :while1 
  if %x% GTR %n% goto prochain1 
  
  set Strin=???name?ofthe?dossier?number?x?????????????
  for /f "tokens=1,* delims=[,]" %%A in ('"%comspec% /u /c echo:%Strin%|more|find /n /v """') do          `set /a l=%%A-4`
  echo Le nom contient %l% lettres.
  
  :leftspace
  
  set Strin=%Strin:_= %
  
  set str=%Strin:~0,1%
  
  if %str% EQU " "( 
  set Strin=%Strin:~1,%l%-1%
  goto leftspace)
  
  
  SET /A x +=1
  goto while1
  :prochain1
  echo Success ! (or not) 
  pause
  :end
  </code></pre>
  
  <p>i just need help for this line:</p>
  
  <pre><code>set Strin=???name?ofthe?dossier?number?x?????????????
  </code></pre>
  
  <p>otherwise the rest should be ok. if you have some critics or something, go on =)</p>