I am trying to create a fairly simple (at least I thought) script to rename part of file's extension. Example:
ren C:\Users\Joe\Desktop\*.TESTJPG C:\Users\Joe\Desktop\*.JPG
I need it to keep the filename, and keep the last part of the extension. Is this possible?
I tried this but it doesn't work.
ren C:\Users\Joe\Desktop\*.TEST??????????? C:\Users\Joe\Desktop\*.???????????
Thanks for any input.
ren C:\Users\Joe\Desktop\*.TESTJPG *.JPG
should work. You can't have a directoryname in the new filename.
Recently I answered a simillar question here , the same code can help you too:
setlocal enabledelayedexpansion
for /f %%a in ('dir *.test* /b') do (
set "name=%%a"&set "name=!name:.test=.!"
ren "%%a" "!name!"
)
Here we are removing the word .test
from files extensions. All you need here is place this script on the same directory as your files are and run it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.