Windows脚本FOR命令重命名目录中的所有文件 [英] Windows scripting FOR command to rename all files in a directory
问题描述
我尝试使用 FOR 命令重命名Windows目录中的所有文件,如下所示:
for(*。*)中的%1执行%1 test%1
例如这会将文件 enc1.ctl 重新命名为 testenc1.ctl enc2.ctl 改为 testenc2.ctl
这不是我想要的。我想要的是
enc1.ctl 重命名为 test1.ctl enc2.ctl strong>
我该如何做?
Akelunuk:
谢谢,那种工作,但我有文件名为
h263_enc_random_pixels_1.ctl,h263_enc_random_pixels_2.ctl 想要分别重命名为
test1.ctl和test2.ctl
如果您知道文件数量(例如10),您可以使用
for / L%1 in(1,1,10)do ren enc%1.ctl test%1.ctl
I am trying to rename all the files present in a Windows directory using FOR command as follows at the command prompt:
for %1 in (*.*) do ren %1 test%1
E.g. This renames a file enc1.ctl to testenc1.ctl enc2.ctl to testenc2.ctl
Thats not what i want. What i want is enc1.ctl renamed to test1.ctl enc2.ctl renamed to test2.ctl
How do i do that?
@Akelunuk: Thanks, that w kind of works but i have files names as
h263_enc_random_pixels_1.ctl , h263_enc_random_pixels_2.ctl which i want to rename to
test1.ctl and test2.ctl respectively
Then how?
If you know the number of files, (say 10), you can use
for /L %1 in (1,1,10) do ren enc%1.ctl test%1.ctl
这篇关于Windows脚本FOR命令重命名目录中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!