批处理重命名一个文件夹,但是原文件名称不变

2025-03-22 13:34:39
推荐回答(3个)
回答1:

你的意思是不是想重命名压缩包中的123为456?

如果是的话:

方法如下:            #我重命名的是123.txt,你按照需要修改。



参考:



Rename files inside of archive. This command is supported for RAR
and ZIP formats. The command syntax is:

winrar rn

For example, the following command:

WinRAR rn data.rar readme.txt readme.bak info.txt info.bak

will rename readme.txt to readme.bak and info.txt to info.bak in
the archive data.rar.

It is allowed to use wildcards in the source and destination names
for simple name transformations like changing file extensions. For
example:

WinRAR rn data.rar *.txt *.bak

will rename all *.txt files to *.bak.

WinRAR does not check if the destination file name is already present
in the archive, so you need to be careful to avoid duplicated names.
It is especially important when using wildcards. Such command is potentially
dangerous, because a wrong wildcard may corrupt all archived names.



顺便:

“压缩后的文件123,分别命名为456,但是原来的文件名还是123” 这句汉语估计99个老外都看不懂。

我也不太确定你的意思,只能说,你太有才了!

回答2:

@echo off
start /w winrar a "456.rar" b   
start /w winrar rn "456.rar" 123.* 456.* 
exit

放在和B文件夹同一目录下运行,只压B文件夹,重名已压好的RaR中所有原文件名为123的文件为456

回答3:

rar a -ep 456.rar d:\a\b\123.txt
只压缩123.txt,不带目录