How to rename Rename multiple files with Windows at the same time ? One solution is to use third party software or the F2 option in the GUI, but the latter is not as flexible as scripting. However, it is simple and effective to use a cmd request.
Here are different command line options to rename a series of several files in batch and in a very fast way. Indeed, these commands allow you to rename a large number of files in a few seconds.
How to easily rename multiple Windows files at once with a cmd command?
For each example below, avboed these 2 key steps:
- Open the Windows command window
- Go to the working directory with the cd command. Or use the full path of the folder that contains the files to be renamed.
For example, if the files to be renamed are in the folder C:\FolderUnderFolder then use this command:
Inverted commas are used to handle folder names with spaces.
How do I rename multiple files in Windows 10?
To rename a large number of files with Windows, simply use the DOS rename command with the * option which allows you to designate all files with a filter.
For example, to rename all Word or docx files starting with chapter1* to chapter2*, use this command:
rename chapter1*.docx chapter2*.docx
How do I rename or remove the prefix from the name of several files?
To rename the prefix of several files, indicate the new prefix or add as many / characters as there are characters to be removed.
This example cmd script renames the prefix “prefix” to “new”:
rename "prefix_*.txt" "new_*.txt"
This command removes the prefix from all files:
rename "prefix_*.txt" "///////*.txt" rename "pre_*.txt" "////*.txt"
How do I delete or rename the suffix of multiple files ?
To rename the suffix of several files, the method is similar to that of the prefixes. As before, indicate the prefix and add as many “/” characters as there are letters to delete:
rename "*_suffix.txt" "*///////.txt" rename "*_copy.txt" "*/////.txt"
To rename the suffix with a new string :
rename "*suffix1.txt" "*suffix2.txt"
How to rename several files without parenthesis ?
Indeed it is convenient to remove an unwanted part of the filename, like the parenthesis. For example after using the F2 option to rename several files with Windows Explorer. Or after making copies with the Windows copy and paste shortcut for example. Windows adds at the end of the files :
- file Copy.txt
- file Copy (2).txt
- file Copy (3).txt
- file Copy (4).txt
As this command is on multiple lines, it should be saved in a text file and renamed to .bat, like parentheses.bat
cd C:\Folder\SubFolder_1 setlocal enabledelayedexpansion for %%i in (*.txt) do ( set f=%%i set f=!f:^(=! set f=!f:^)=! ren "%%i" "!f!" )
Then execute it with a Right-Click and then “Run as administrator“. The result will be :
- file Copy 2.txt
- file Copy 3.txt
- file Copy 4.txt
Thanks to Tips Box channel for the solution.
How do I rename the extension of several Windows files at once ?
To rename the file extension only and not the full file name, use this command:
rename *.text *.txt
How to rename thousands of Windows files quickly ?
Moreover, the main advantage of renaming files in series is the speed. For example, to rename several tens of thousands of images, use this batch:
rename *_accounting_files_2020.xlsx *_2020_*.xlsx
How to rename several images simultaneously ?
For images like JPG or PNG, it’s similar to other file extensions. It is only the extension filter that changes in the script. For example, how to rename files with the extension .JPG to .JPEG ?
rename *.jpg to *.jpeg
Finally, how to rename several files with different names incrementally ?
This case is slightly different, because to create unique file names, the system adds sequential numbers to the files. To do so, use the Windows command F2, from the Windows Explorer.
- Select the files to rename
- Press F2 (or right click on the first one in the list and then Rename in the context menu)
- Enter the new file name to apply
By typing “File”, the result will be :
- File (1).txt
- File (2).txt
- File (3).txt
- File (4).txt
- and so on.
As you can see the rename, or ren, command has a wide variety of usage ans is very powerful compared to manually rename dozens of files.
Check out also how to copy recursively multiple files with a batch.