Home > Commands N-Z > Commands R


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Changes the name of the file or files you specify.

You can rename all files matching the specified filename. You cannot use the RENAME command to rename files across drives or to move files to a different directory location. To rename subdirectories or move files, use the MOVE command.



REN[AME] [drive:][path]filename1 | directory1 filename2 | directory2

drive: ( filename1 v1.0)
drive: ( path filename1 v2.0 Win95 NT3.5)
Specifies the location and name of the file or set of files you want to rename.
directory1 (v7.00 Win95)
Specifies the old name for the directory you want to rename.
directory2 (v7.00 Win95)
Specifies the new name for the directory. (You cannot specify a new drive.)
filename2 (v1.0 Win95 NT3.5)
Specifies the new name for the file or, if you use wildcards, the new names for the files. (You cannot specify a new drive or path.)

/? (NTXP)
Displays help.


For information about renaming directories, see the MOVE command.
For information about renaming a disk, see the LABEL command.
For information about copying files to a different drive or directory, see the COPY command.
For information about copying entire directories to a new location, see the XCOPY command.
Equivalent Linux BASH commands:
mv - Move or rename files or directories.

Using wildcards with RENAME

You can use wildcards (* and ?) in either filename parameter. If you use wildcards in filename2, the characters represented by the wildcards will be identical to the corresponding characters in filename1.

RENAME will not work if filename2 already exists

If, for filename2, you specify a filename that already exists, RENAME displays the message:

    Duplicate file name or file not found

REN as abbreviation for RENAME

REN was allowed as an abbreviation since v1.1


Suppose you want to change the extensions of all the filenames in the current directory that have the extension .TXT; for example, suppose you want to change the .TXT extensions to .DOC extensions. To make this change, type:

    REN *.TXT *.NEW

To rename a file named CHAP10 (on drive B) to PART10, type:


The newly renamed file PART10 remains on drive B.



v1.0 v1.05 v1.1 v1.11 v1.24 v1.25 v1.85 v2.0 v2.01 v2.05 v2.10 v2.11 v2.11R v2.12 v2.2 v2.25 v3.0 v3.20 v3.05 v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003