简体   繁体   English

.bat将文件夹/子文件夹中的文件重命名为特定名称

[英].bat rename files in folders/sub-folders to specific name

I need a .bat file that can go into a folder with many sub-folders and rename every .iso file to "Game.iso". 我需要一个.bat文件,该文件可以放入包含许多子文件夹的文件夹中,并将每个.iso文件重命名为“ Game.iso”。 I had a way to do it but I cant seem to find it anymore and I lost the damn file :(. 我有办法做到,但是似乎找不到了,我丢了该死的文件:(。

Example: 例:
-Main DIR -主目录
--A - 一种
---file name.iso ---文件名.iso
--B --B
---file name.iso ---文件名.iso
--Z --Z
---file name.iso ---文件名.iso

What I want to be like when I run .bat file: 运行.bat文件时我想要的样子:
-Main DIR -主目录
--A - 一种
---game.iso --- game.iso
--B --B
---game.iso --- game.iso
--Z --Z
---game.iso --- game.iso

That is really my main concern. 这确实是我主要关心的问题。 That would be super amazing and I would appreciate it tremendously. 那将是非常惊人的,我将不胜感激。

Simple: 简单:

for /r %%a in (*.iso) do (
ren "%%~a" "%%~paGame.iso"
)

And that should work. 那应该起作用。 Simply run it from the Main Dir 只需从Main Dir运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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