In this post I will show you how to rename file extensions in Windows from the command line. We’re going to do this using the built-in Command Prompt and Windows PowerShell. No third-party tools are required.

Rename File Extensions Using Command Prompt

Rename all file extensions in a folder

To rename all file extension in a folder we can just use the rename command. For example, say you have a folder with 100s of jpeg files, and you want to rename them to .jpg. You can do that with this command:

rename *.jpeg *.jpg

And you’re done. This command works only in the directory you’re in. So if you wanted to rename extensions of files in sub-folders as well, this wouldn’t do. To do that, have a look at the next command.

Rename all file extensions in a folder and its sub-folders

To recursively rename extensions in all sub-folders you can use this command:

forfiles /S /M *.jpeg /C "cmd /c rename @file @fname.jpg"

Rename File Extensions Using Windows PowerShell

Rename all file extensions in a folder

To rename extensions of all file in a folder, you can use this PowerShell command: