my-server
← Wiki Redirected from RENAME

Ren (command)

<code>ren</code> (or <code>rename</code>) is a shell command for renaming a file and in some implementations (such as AmigaDOS) a directory.

Some shells with also provide a <code>move</code> command that provides for moving between directories. On systems that do not support a <code>move</code> command (such as MS-DOS older than 6.00), the user could copy a file to a new destination and then delete the original file. In DOSBox, <code>ren</code> can move files.

The command is in various shells such as COMMAND.COM, Command Prompt, 4DOS, 4NT and PowerShell. In MS-DOS, the command is available in versions 1 and later. In PowerShell, <code>ren</code> is a predefined alias for the <code>Rename-Item</code> Cmdlet which serves the same essential purpose.

Similar commands are available in many operating systems. The command is available in the CP/M, MP/M, Cromemco DOS, TRIPOS, OS/2, ReactOS, SymbOS, and DexOS. Multics includes a <code>rename</code> command to rename a directory entry, which could be contracted to <code>rn</code>. A command which in some cases can be contracted to <code>ren</code> is provided in Stratus VOS, RT-11, OS/8, RSX-11, ISIS-II, iRMX 86, TOPS-20, Z80-RIO, FLEX, OS-9, FlexOS, 4690 OS, MPE/iX, THEOS/OASIS, and OpenVMS A <code>rename</code> command is supported by 86-DOS. DR DOS 6.0 includes and commands. PC-MOS includes an implementation of <code>rename</code>. It is also available in the MS-DOS emulator DOSBox.

Example

The following renames file to .

The following renames a file specified by a fully qualified path. The first parameter may contain drive and path information, but the second parameter must be only a file name.

The following removes abcd of a file name in Command Prompt based on the following rules:

  • Same number of <code>/</code> as the number of characters to remove
  • Requries double quotes for both arguments
  • Won't remove <code>.</code> from a file name

See also

References

Further reading

External links