Programming Field

Ren, Rename - DOS/Command Prompt Reference

Changes the name of the file.


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


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.


Usage of Ren(Rename)

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



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.