Skip to main content

How to Rename a Directory in CMD

• 1 min read
cmd command-prompt directory ren rename windows

You can use the following syntax in Command Prompt (CMD) to rename a directory:

ren old_directory_name new_directory_name

This particular example will rename the specified directory to the new name.

Note: Ensure that the new directory name you provide does not already exist, otherwise you will receive an error.

The following example shows how to use this syntax in practice.

Example: Renaming a Directory in CMD

Suppose that we want to rename a directory named my_app to my_demoApp in the following path:

C:\Users\admin\Documents\cmd_script

We can type the following command to rename the directory:

ren C:\Users\admin\Documents\cmd_script\my_app my_demoApp
```powershell
The following screenshot shows how to use this syntax in practice:

!Rename a directory in cmd

We can see that the directory **my_app** has been renamed to **my_demoApp** in **C:\Users\admin\Documents\cmd_script**.

## Conclusion

We can use the **ren** command followed by the path to rename any directory on the system.

You can find more topics about Active Directory tools and PowerShell basics on the [ActiveDirectoryTools](https://activedirectorytools.net/) home page.