Rename Command Examples Options Switches More

Rename Command Examples Options Switches More

Rename Command (Examples, Options, Switches, & More) GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Software & Apps > Windows

Rename Command

'Rename' command examples, options, switches, and more

By Tim Fisher Tim Fisher Senior Vice President & Group General Manager, Tech & Sustainability Emporia State University Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the VP and General Manager of Lifewire. lifewire's editorial guidelines Updated on May 12, 2022 Tweet Share Email Tweet Share Email

In This Article

Expand Jump to a Section Availability Syntax Examples Extra: Related Commands The rename command is used to rename a single file or folder from the Command Prompt. Rename and ren can be used interchangeably. They're the exact same command.

Rename Command Availability

The rename command is available from within Command Prompt in most versions of Windows, including Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server operating systems, and some older versions of Windows, too. The rename command is also available from within the Recovery Console in Windows 2000 and Windows XP. See our Recovery Console commands list for more.

Rename Command Syntax

rename [drive:][path] filename1 filename2 See How to Read Command Syntax if you're not sure how to read the rename command syntax explained above or in the table below. Rename Command Options Item Explanation drive: This is the drive containing the file you want to rename. path This is the folder or folder/subfolders located on the drive:, containing filename1 that you want to rename. filename1 This is the name of the file you want to rename. filename2 This is the name you want to rename filename1 to. You can not specify a new drive or path for the renamed file. The rename command can only be used to rename files in the system folders of the current Windows installation, in removable media, in the root folder of any partition, or in the local installation source.

Rename Command Examples

Below are several examples showing how you can use the rename command.

Rename File in Specified Folder

rename c:\windows\win.ini win.old In the above command, we're renaming win.ini, located in the C:\Windows folder, to win.old.

Rename File in the Same Folder

rename boot.new boot.ini In this one, the rename command has no drive: or path information specified, so the boot.new file is renamed to boot.ini, all within the directory you typed the rename command from. For example, if you type rename boot.new boot.ini from the C:\> prompt, the boot.new file located in C:\ will be renamed to boot.ini.

Rename File Extension and Name

ren file.bak regfile.reg In this example, the rename command (shortened here to ren) is used not to rename the "normal" filename part but just the file extension, similar to the two example above. This isn't something you'll be doing often, but if you for some reason to do change the file extension, you can do so with the rename command. We're renaming a backup with the bak file extension to a file with the REG file extension so that we can restore it to the Windows Registry (something you can only do if it ends in .reg). However, we're also changing the name of the file to regfile, something we can do inside the same command so that we don't have to run two separate commands. Changing the file extension doesn't actually change the file's format. Unlike a file converter tool which formats the actual file itself, the ren command can only adjust the suffix. In most situations, like in the example above, this results in Windows treating it differently (e.g., now it can open in Windows Registry).

Rename a Folder

ren pictures "vacation pics" In this last sample, we're using the rename command to rename a folder instead of a file. The pictures folder will become vacation pics. Quotes are used around the folder name since it contains a space.

Rename Related Commands

This command is often used with the dir command so that you can see the list of filenames within Command Prompt before choosing which one to rename. How to Batch Rename Files in Windows 10 Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit More from Lifewire Copy Command (Examples, Options, Switches, and More) Vol Command Examples and Options Del Command (Examples, Options, Switches, and More) More Command (Examples, Options, Switches, and More) Dir Command (Examples, Options, Switches, & More) Fixboot Command (Recovery Console) Net Send Command (Examples, Switches, and More) Attrib Command (Examples, Options, Switches, and More) Sfc Command (Examples, Options, Switches, and More) Net User Command (Examples, Options, Switches, & More) WinDirStat Review (Free Disk Space Analyzer) Net Command (Examples, Options, Switches, and More) How to Use the Netstat Command Msg Command (Examples, Switches, and More) Xcopy Command (Examples, Options, Switches, and More) Diskpart Command (Examples, Options, Switches & More) Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies
Share:
0 comments

Comments (0)

Leave a Comment

Minimum 10 characters required

* All fields are required. Comments are moderated before appearing.

No comments yet. Be the first to comment!