问题
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:
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.
来源:https://stackoverflow.com/questions/29040441/im-trying-to-remove-retch-from-my-file-names-with-my-batch-script