Now have added a few aesthetics by reporting the number of files renamed.
Warning: Use at own risk
The script:
@echo off
setlocal EnableDelayedExpansion
set /a a=0
for /f "delims=" %%I in ('dir /b ^| find "%%20"') do (
set var01=%%I
set var02=!var01:%%20=" "!
call :ren
)
echo.
echo Successfully renamed %a% files.
pause
exit
:ren
ren "%var01%" %var02%
if %ERRORLEVEL%==0 echo Renamed %var01%
if %ERRORLEVEL%==0 set /a a=%a%+1
Instructions:
1. Copy the script above and paste into notepad
2. Save it as "spaceReplacer.bat", file type: All Type.
3. Put it in the same folder as the files with %20
4. and run
5. Success!












0 comments, add yours>>:
Post a Comment