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!
Thursday, October 6, 2011
at 10/06/2011 12:35:00 PMNew script for delete %20 in batch
Posted by cxjiek 0 comments, add yours>>
Labels: bat
Subscribe to:
Posts (Atom)