Insert characters into file name

January 21, 2011 at 02:38:00
Specs: Windows XP, Core2Duo/2GB
Hello everybody,

I have some files that are named:
I want to create a batch that will rename all the files in the directory in this way:

Or generally speaking:
1- Insert a "." after the 20th character
2- Insert a "_" after the 22th character
3- Insert a "_" after the 24th character

Please help me on this.

Thank you all and regards,

See More: Insert characters into file name

Report •

January 21, 2011 at 08:05:01
Remember PCs read from right to left so you have to thing how many characters from the right...

@echo off
Set FileName=AB_ASDFGHJ1234-45-56677889
Set NewFileName=%FileName:~-26,20%.%FileName:~-6,2%_%FileName:~-4,2%_%FileName:~-2,2%
echo %NewFileName%

Report •
Related Solutions

Ask Question