Is there an easy way to add an extension to multiple files which do not have an extension? How can I change file extension for all files in a folder? Changing file extension one by one can be a frustrating task if you have to process a large number of files. In this tutorial we’ll show you how to batch add or change extensions for multiple files located in a folder on Windows 11.
Part 1: Add Extension to All Files in a Folder
If you need to append file extension to all files in a folder, just open an elevated Command Prompt. Use the cd
command to navigate to the target folder. To add an extension to all files at once, run this command. Replace .jpg with your desired file extension.
ren * *.jpg
You can use this method to easily rename Windows spotlight images located in the directory: %LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets.
Part 2: Add Extension to All Files without Extension
What to do if you have a folder with a bunch of images inside and you want to add .jpg file extension, but you need to exclude existing files which end with .doc or .txt?
To add .jpg extension to all files which have no extension, open Windows PowerShell as administrator and execute this command:
Get-ChildItem -exclude '*.doc','*.txt' | WHere-Object{!$_.PsIsContainer} | Rename-Item -newname {$_.name + ".jpg"}
The “-exclude” parameter allows you to specify certain file types which you wish to exclude from appending file extension.
Part 3: Change File Extension of All Files in a Folder
When you need to change file extension for all files in a folder, open Command Prompt as administrator and run this command:
ren *.old_extension *.new_extension
It will quickly rename all files with the new extension available in the command.