Windows 10

How to Change Multiple File Extensions at Once in Windows 10 Using PowerShell

In this tutorial, we are going to see how to change multiple file extensions at once in Windows 10 using PowerShell. To change multiple file extensions at once in all folders, the command you use must recursively search for the target file type in all subfolders of the target folder and rename it. In fact, you don’t even need to use a third-party application. A single command will do the job. Here’s how.
 

How to Change Multiple File Extensions at Once in Windows 10 Using PowerShell

Step 1: Press Windows + X button and select Windows PowerShell (Admin). This is the fastest way to open the PowerShell as an administrator.
 


 
 
Step 2: If the files you want to rename are in drive C, skip this step. Otherwise, use the command below to access that drive. Remember to replace <DriveLetter> with the actual drive letter. In my case, I’m going to drive D.

<DriveLetter>:


 
Step 3: Then use the command below to go to the folder where the files are located. Replace the dummy path with the path to the real folder. The command we are going to use will rename the target file type in this folder and all its subfolders.

cd "D:Path/To/Folder"

Tips: Drag and drop the folder into the command prompt and it will automatically fill in the folder path.

 

 
Step 4: Once in the target folder, run the command below replacing “ext1” with the current file extension and “ext2” with the file extension you want.

Dir *.ext1 | rename-item -newname { [io.path]::ChangeExtension($_.name, "ext2") }

Here, we will replace “jpg” file with “png” file. As you can see in the following image:

 
That’s all. Once you run the command, the command prompt will go through all the subfolders in the target folder and rename the file extension.
 

Leave a Reply

Your email address will not be published. Required fields are marked *