Jump to content

Ren (command)

From Alfawiki
ren
Company typeShell command
IndustryComputing / Software
ProductsFile renaming utility

ren (also known as rename) is a shell instruction used to change the name of a file and, in certain versions such as AmigaDOS, can also rename a directory.

In some shell environments, ren is accompanied by a move command that facilitates transferring files between directories. On platforms lacking the move command—for example, MS-DOS versions prior to 6.00—users had to manually copy files and then delete the originals to relocate them. Within DOSBox, the ren command is capable of moving files.

This command is incorporated in shells like COMMAND.COM, Command Prompt, 4DOS, 4NT, and PowerShell. It has been part of MS-DOS since its initial release (version 1). In PowerShell, ren acts as a shortcut for the Rename-Item Cmdlet, which performs an equivalent function.

Comparable commands exist across numerous operating systems, including CP/M, MP/M, Cromemco DOS, TRIPOS, OS/2, ReactOS, SymbOS, DexOS, among others. Systems such as Multics offer a rename command targeting directory entries, sometimes abbreviated as rn. Variations of rename/ren are also found in operating systems like 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.

Older platforms such as 86-DOS support the rename instruction. Contemporary DOS derivatives like DR DOS 6.0 provide both ren and rename, while systems like PC-MOS have implemented the rename command as well. The MS-DOS emulator DOSBox also includes this functionality.

Example

The command below changes the file name from to .

<syntaxhighlight lang="doscon"> > ren foo bar </syntaxhighlight>

When renaming a file using its complete path, the first argument may specify the drive and directory, whereas the second argument should contain only the new file name.

<syntaxhighlight lang="doscon"> > rename "C:\Users\Public\Videos\Sample Videos\Wildlife.wmv" Wildlife2.wmv </syntaxhighlight>

The example below demonstrates how to eliminate abcd from filenames within Command Prompt, adhering to these guidelines:

  • The number of / characters must equal the count of characters being removed
  • Both parameters require enclosing double quotes
  • The period ('.') in the filename remains unaffected

<syntaxhighlight lang="doscon"> > rename "abcd*.txt" "////*.txt" </syntaxhighlight>

See also

Further reading

External links