Programming Field

Ren, Rename - DOS/Command Prompt Reference

Changes the name of the file.

Syntax

ren <old-file-path> <new-file-name>
rename <old-file-path> <new-file-name>

Options

ren, rename This command can be either ‘ren’ or ‘rename’.
<old-file-path> Specifies the file to rename. Either the absolute or relative path is allowed. Also the directory can be specified.
<new-file-name> Specifies the name after change. The path cannot be specified.

Details

Usage of Ren(Rename)

This command only changes the ‘name’ of the file. To change file's parent directory or drive, use Move command.

Samples

Sample

ren C:\Foo\document.txt hello.txt

Renames the name of the file ‘C:\Foo\document.txt’ to ‘hello.txt’. In this case, replacing ‘ren’ with ‘move’ results to move ‘document.txt’ into the current directory.