重命名文件或目录。
Note
This command is the same as the rename command.
Syntax
ren [<drive>:][<path>]<filename1> <filename2>
Parameters
Parameter | Description |
---|---|
[<drive>:][<path>]<filename1> |
指定要重命名的文件或文件集的位置和名称。 Filename1 can include wildcard characters (* and ?). |
<filename2> |
为文件指定新名称。 你可以使用通配符为多个文件指定新名称。 |
/? | 在命令提示符下显示帮助。 |
Remarks
重命名文件时不能指定新的驱动器或路径。 你也不能使用此命令跨驱动器重命名文件或将文件移动到不同的目录。
Characters represented by wildcard characters in filename2 will be identical to the corresponding characters in filename1.
Filename2 must be a unique file name. If filename2 matches an existing file name, the following message appears:
Duplicate file name or file not found
.
Examples
若要将当前目录中的所有 .txt 文件扩展名更改为 .doc 扩展名,请键入:
ren *.txt *.doc
To change the name of a directory from Chap10 to Part10, type:
ren chap10 part10