批处理文件中文件的批处理重命名 [英] Batch Renaming of Files in a Batch File

查看:121
本文介绍了批处理文件中文件的批处理重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要重命名许多文件,并需要在批处理文件中进行操作.

文件名不同,我需要在文件名前以0填充文件.
-------------------------------------------------- -----------------------
我不知道关于脚本的第一件事:confused:
我已经在使用批处理文件复制文件,那么我需要在前面添加一个0.那就是我要做的.
批处理文件:

Hi,

I need to rename a lot of files and need to do it in a batch file.

The file names differ and I need to "pad" the files with a 0 in front of the file names.
-------------------------------------------------------------------------
I don''t know the First thing about scripts :confused:
I''m already using a batch file to copy files then i need to add a 0 in front. that is all I want to do.
Batch File:

XCOPY Z:\*.* D:\CClas\CCLASFML\Reports\Certificate /D:01-26-2010 /C
XCOPY Y:\*.* D:\CClas\CCLASFML\Reports\STT /D:01-26-2010 /C


-------------------------------------------------- -----------------------
该过程必须是自动化的,并且服务器没有Powershell :(

这就是我在寻找的东西:


-------------------------------------------------------------------------
The process must be automated, and the server does''nt have Powershell :(

This is what i''m looking for:

for %i in (*.*) do ren %i 0%i

但是当我使用它时,dos告诉我:
i was unexpected at this time.
-------------------------------------------------- -----------------------
知道了!
正确的代码是:

but when i use it dos tells me :
i was unexpected at this time.
-------------------------------------------------------------------------
Got It!
The Correct Code is:

for %%N in (*.*) do ren "%%N" "0%%N"


谢谢EveryOne


Thanks EveryOne

推荐答案

为什么不使用脚本?
:)
Why don''t you use a script?
:)


这并不是您的问题的真正答案,而是替代的解决方案,但我认为值得一提.您是否尝试过Total Commander的多重重命名工具(Ctrl + M)?
如果您要自动化某事,那将无济于事,但是,如果您只需要不时复制/重命名某事,则值得一试.只是一个想法:)
This is not really an answer to your question, but rather an alternative solution, but I think it''s worth mentioning. Have you tried Total Commander''s Multi Rename Tool (Ctrl+M)?
If you are automating something this won''t help, but if you just need to copy/rename something from time to time - it''s worth a try. Just a thought :)


类似的东西:
Something like:
for %i in (*.*) do ren %i 0%i


这篇关于批处理文件中文件的批处理重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆