With all the media available on the Internet and the huge collection of digital libraries and images, we all have trouble renaming many files so they can be accessed. Access is easier with a pronounceable name or a meaningful name. Renaming a bunch of files one by one is not only frustrating but also a time-consuming undertaking. Considering this fact, Microsoft has long introduced a batch renaming feature in Windows explorer that helps you to rename multiple files at once.

3 cách đổi tên tập tin trong Windows

Sure, you can use third-party tools to batch rename files, but usually, these tools have many features that confuse the average user, and you don’t want to install a piece of software. Other to rename some files sometimes.

Using Windows Explorer to batch rename files in Windows is probably the easiest way. To batch rename files, select all the files you want to rename, press the F2 button (or right-click and choose rename), type the name you want, and press the enter button.

Batch-rename-files-win-explorer-đổi tên

The action above is to get the filename you specified and add a number for each filename. As you can see from the images above and below, I have renamed the files from “test (*). Html “into” file (*). Html ”.

Batch-rename-files-win-explorer-đổi tên-thực hiện

It’s easy to rename files using Windows Explorer, but this method is basic and not flexible. For example, you can’t change file extensions (.html) and cannot restrict or change Windows from adding numbers, etc. For more advanced functions, We need to use the command prompt and Windows Powershell.

Renaming batch files using the Windows command prompt is much more flexible, and the good thing about using this method is that you can also change the extensions of those files. First of all, let’s see how to rename the executable without changing the extension.

1. Open the folder containing the renamed files. Here click on File and on “open command prompt.”


2. The above operation will open a command prompt window in the desired location. Now enter the following command to batch rename files. Don’t forget to replace “file” with the current filename and “name” with your desired name. Because we are using wildcards, you don’t need to enter the full filename.

 ren file * .html name * .html

Batch-rename-files-cmd-nhắc-thay đổi tên

Once you have executed the command, all files are renamed to the new name while keeping the extensions intact. If you want to change many extensions (e.g., HTML to txt), then use the following command.

 ren * .html * .txt

Batch-rename-files-cmd-nhắc-thay đổi-mở rộng

The above command will rename all files with the .html extension in the directory to .txt.

Batch-rename-files-cmd-nhắc-thay đổi-tiện ích mở rộng

Windows Powershell is much more powerful than a regular command prompt and also easy to use. To batch convert files using Powershell, we need to use two commands, i.e., DIR and Rename-Item. Now batch convert without changing their extensions, press the WIN button, type “powershell” and press the button to open Powershell.

Batch-đổi tên-tập-mở-powershell

When Windows Powershell is opened, navigate to the desired directory using the CD command. As for me, I’m navigating to D: mte as this is where my files are located.

Once you are in position, use the command below. While using the command, don’t forget to change “TestName” to your desired filename.

 dir | % {$ x = 0} {Rename-Item $ _ -NewName "TestName $ x.html"; $ x ++}

Batch-rename-files-windows-powershell-đổi tên

The above command does not mean it will get all the files in the directory using the DIR command and go to ” Rename-Item" but rename all the files to “TestName *.” Here * denotes numbers, and those numbers are allocated recursively with “$ X.”

If you want to change file extensions of all files in a directory, use the below command.

 Get-ChildItem * .html | Rename-Item -NewName {$ _. Name -replace ' .html', '. Txt'}

Batch-rename-files-win-powershell-thay đổi-mở rộng

The above command is to take all the files with .html extension in a directory and change them to .txt.


To learn more about the Rename-Item command, read the manual for more definitions and examples.

Which of the above three methods do you like? Sure, Powershell can be overwhelming for beginners, but it is a lot of fun working with once you’ve gained some experience.