Solved How to Replace a words in Filename using Bat files

September 20, 2012 at 19:43:37
Specs: Windows XP
I want to replace some words in filename of pdf. For example:

Original BK001_A1_01234567_SAMPLE.pdf

To BK001_A_01234567_SAMPLE.pdf

**To replace "A1" to become "A"

Can anyone help?

Thanks


See More: How to Replace a words in Filename using Bat files

Report •

#1
September 21, 2012 at 05:40:33
✔ Best Answer
:: ===== script starts here ===============
::
:: ren.bat 2012-09-21 11:47:31.18
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b BK001_A* ') do (
set S=%%a
set F=!S:~0,7!
set B=!S:~8!
echo ren %%a !F!!B!
)
::====== script ends here =================


====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question