本文介绍了使用批处理重命名从文件名中间删除文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试整理一系列像这样的视频文件:
I'm trying to de-organize a series of video files named like this:
Something or Other.s1e1.mp4
Another title.s1e2.mp4
...
Yet More Titles.s1e87.mp4
以此类推.我想做的是去掉文件名的"s1eNUM"部分,并将其恢复为正常,所以我会得到"Something or Other.mp4"和"Yet More Titles.mp4"之类的信息.
And so on. What I want to do is strip out the "s1eNUM" part of the filename and restore it back to normal, so I'd get "Something or Other.mp4" and "Yet More Titles.mp4" and such.
可以使用Windows命令行以及ren和批处理文件来完成此操作吗?还是我需要特殊的软件?谢谢!
Can this be done using Windows command line, with ren and batch files? Or do I need special software? Thanks!!
推荐答案
使用for命令.
@echo off
set YourFileName=title.s1e2.mp4
for /f "tokens=1 delims=." %%x in ("%YourFileName%") do (set filename1=%%x)
for /f "tokens=3 delims=." %%x in ("%YourFileName%") do (set filename2=%%x)
echo %filename1%.%filename2%
rename C:\PATH\%YourFileName% %filename1%.%filename2%
pause>nul
这应该删除中间的"s1eNum",然后在末尾结合文件名和扩展名.
This should remove the "s1eNum" in the middle, then combine the file name and the extension at the end.
这篇关于使用批处理重命名从文件名中间删除文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!