I'm trying to remove “ .RETCH ” from my file n

2019-09-11 15:40发布

I'm simply trying to have my existing script remove " .RETCH " from the file name.

ex. " B00TI8DTJY.RETCH.PT01.jpg --> B00TI8DTJY.PT01.jpg "

I know how to remove a certain amount of characters or add something to the file name but can't figure out how to Only remove the .RETCH part.

Thanks.

1条回答
Luminary・发光体
2楼-- · 2019-09-11 16:14
setlocal enabledelayedexpansion
for /f %%a in ('dir *RETCH* /b') do (
 set "name=%%a"&set "name=!name:.RETCH=!"
 ren "%%a" "!name!"
)

Just run this on the same directory as your files. If it's needed to go on subdirectories then add /s flag to dir command.

查看更多
登录 后发表回答