How Do You Rename Files in DOS?

How Do You Rename Files in DOS?

When there is no graphical user interface such as Windows, command names become important. In MS-DOS, ren or rename are the common commands used to rename files in DOS.

  1. Use the ren or rename command for single files

    Newer versions of MS-DOS and command line interfaces for Windows uses the ren or rename command. If changing a filename x1.dat to x3.dat, the command would be "rename x1.dat x3.dat". If changing the extension from ".dat" to ".bak," the command would be "rename x1.dat x1.bak".

  2. Use wild cards for handling multiple files

    Wild cards such as "*" are useful to avoid many operations when one is sufficient. If every file in a directory needs a new standard beginning, such as "Feb." for the month of February, the command would be "rename *.* Feb*.*". This can also be done at the end of the filename ("rename *.* *Feb.*). If files instructions1.dat, instructions2.dat, and instructions3.dat all need their file extensions changed to ".bak," then the command "rename instructions*.dat instructions*.bak" makes those changes.

  3. Use quotes if changing directories that include a space

    Directories can also be renamed using this command, but more care must be taken. If the directory name is one word, simply using "rename directory1 directory2" is fine. If there are spaces, then each directory name must be in quotes (' rename "My Notes" "My February Notes" ').