使用DOS-Batch重命名子目录中的文件

时间:2011-02-28 10:29:49

标签: windows batch-file rename

我希望BATch检查目录中是否有2个给定文件 +如果他们改名字

到目前为止,我已经得到了这个:

@echo off

if exist %order.xml && %order.xml.orig goto RENAME
goto END

:RENAME
rename order.xml order.xml.old
rename order.xml.orig order.xml

:END
pause

哪个工作得很好,但问题是我必须将其复制到每个子目录中。 有没有办法让BATch检查每个子文件夹?我尝试的一切只是给了我一个语法错误

1 个答案:

答案 0 :(得分:0)

您正在寻找:

recursive renaming file names + folder names with a batch file

所有它都是带有goto语句的for循环。答案实际上只是重命名文件,而不是文件夹,所以应该正是你想要的。

相关问题