examinedliving
9/3/2013 - 11:35 PM

Renames a bunch of files that have an underscore as the first character to the name without the underscore. The extension and first charact

Renames a bunch of files that have an underscore as the first character to the name without the underscore. The extension and first character are changeable - also could be multiple first characters.

setlocal enabledelayedexpansion

for /r %%i in (*.html) do (
  set a=%%~nxi
  set b=!a:~0,1! 
  if /i NOT "!b!"=="_ " (
      del "%%i"
  ) else (
     set c=%%~nxi 
     set d=!c:~1,1000!
     rename %%i !d!
  )
)