I'm trying to remove “ .RETCH ” from my file names with my batch script

别来无恙 提交于 2019-12-25 01:38:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!