In this article, you will learn the way to change / rename file extensions in windows with command prompt.
Question:
Suppose you have a folder in which thousands of .TXT file exist and you want to change their extension to .XLS. How to change the extension?
Answer:
There are two ways to change / rename a file extension:
- Rename a single file extension
- Rename multiple files extension in bulk
Step-1:
Open command prompt > Go to the folder in which your file exist.
- C:\Users\Administrator\Desktop> CD Test
- C:\Users\Administrator\Desktop\Test
- C:\Users\Administrator\Desktop\Test> Dir
- C:\Users\Administrator\Desktop\Test> ren Sample-1.txt Sample-1.xls
In this example, I have used ren Sample-1.txt Sample-1.xls command.
You can see the result in below snapshot.
Step-2:
Open command prompt > Go to the folder in which your file exist.
- C:\Users\Administrator\Desktop> CD Test
- C:\Users\Administrator\Desktop\Test
- C:\Users\Administrator\Desktop\Test> Dir
- C:\Users\Administrator\Desktop\Test> ren *.txt *.xls
Either you can run ren *.txt *.xls command on command prompt or you can write this command in batch file as shown in below snapshot.
Put this batch file in the same directory where your files exist. Just double click on the batch file and you are done.
By this way all .txt files in the directory will be changed to .xls file.
You can see the results in below snapshot.
By this way you can change file extensions of all the files in a folder.