XP批处理脚本重命名文件并复制到新文件夹

发布于 2024-09-10 10:19:08 字数 155 浏览 1 评论 0原文

我有数百个图像文件。我想用批处理脚本执行两项任务。

1)我想重命名名称不带“_”的文件(如果有)并将它们移动到临时文件夹。

2)如果任何文件与文件名重复,则取出该文件中的任何一个并将其移动到指定的临时文件夹。

有人知道该怎么做吗?提前致谢...

I have hundreds image files. I want to do 2 tasks with batch script.

1) I want to rename files with the name without '_' if any file have and move them to temp folder.

2) if any file duplicates with file name then take it any of the file and move it to specified temp folder.

Anyone knows how to do this? Thanks in advance...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2024-09-17 10:19:08

对于重命名部分...您可以尝试这个方法...

@echo on
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%i in ('dir *.txt /b/a-d') do (
set name=%%i
set name=!name:_=!
ren %%i !name!
)

对于文件移动部分...您能详细说明一下要求吗?

——尼哈尔

for the renaming part...you could try this approch...

@echo on
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%i in ('dir *.txt /b/a-d') do (
set name=%%i
set name=!name:_=!
ren %%i !name!
)

For the file moving part...could you please elaborate the requirement a little more?

--Nihar

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文