Batch script to partially rename many files

June 9, 2011 at 11:16:03
Specs: Windows 7
Hi there, I created the following batch file for Windows 7 based on another member's old solution (i.e. related thread is now closed):

@echo off
cls
setlocal enabledelayedexpansion

for /f "tokens=1* delims= " %%1 in ('dir /b *.epub') do (
set oldfilename=%%1 %%2
set newfilename=%%2
echo Oldfilename=!oldfilename!
echo Newfilename=!newfilename!
pause>nul
echo.&echo.
ren !oldfilename! !newfilename!
)


When listing the proposed changes, the echoed newfilename is exactly what I want but the OS comes up with "The syntax of the command is incorrect" when it reaches the REN line. What am I doing wrong????

Thanks!


See More: Batch script to partially rename many files

Report •

#1
June 9, 2011 at 16:25:55
This should be posted here: http://www.computing.net/forum/prog...

Report •
Related Solutions


Ask Question