Practically the REN command to rename files, here are a few examples in the cmd.e / command prompt (under Windows 11, 10, ... etc.)!
This short renaming FAQ relates to: ► Renaming files multiple times in the file explorer using commands ◄ you should first deal with placeholders in order to use them effectively, some renaming tools become superfluous!
Example 1: Change file extension from log to txt
rename *.log *.txt
We can rename, change the extension of files in batch with the REN or RENAME command . For example, suppose you have a number of files with a .jpeg extension and you want to rename them to .jpg. You can do this with the following command ren *.jpeg *.jpg, all files in the current directory will be changed from *.jpeg to *.jpg
Example 2: Change file extension also in the subdirectory
forfiles /S /M *.jpeg /C "cmd /c rename @file @fname.jpg"
If you want to rename files recursively in all subfolders from one extension to another, you can use the forfiles command in combination with rename or ren .
The following command would completely remove the extension for the specified file types.
forfiles /S /M *.jpeg /C "cmd /c rename @file @fname"
Example 3: Simple renaming of a file
rename "d:\My Documents\file-1.doc" file-2.doc
After executing the above command, file-1.doc will be in the d:\My Documents\file-2.doc folder
FAQ 82: Updated on: 11 August 2021 17:48