简体   繁体   中英

Windows batch script for renaming files to remove their extensions

I have a lot of files in a directory named *.mkv.bin eg:

American Pie 1.mkv.bin

I want to rename these files using a to delete .bin as follows:

American Pie 1.mkv
FOR /R "I:\" %%f IN (*.mkv.bin) DO REN "%%f" "%%~nf"

working.

@echo off
color 0a
title Stack Overflow Answer

set /p f=File to rename(drive and path):
set /p e=Extension to rename to:
set /p nf=File name to rename to:
echo Renameing...
@ren "%f%" "%e%.%nf%"
cls && echo Done! && pause >nul
exit

add this text a rename.bat file 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM