Few days back, I had posted an article on how to rename multiple files at once. But that tutorial is limited to change file names only. What if you want to change multiple file formats at once? Of course, it would be a tedious task to change them one by one.
After a deep study of 1 hour, I was successful in creating a small batch program that can help you to change multiple file formats in just few seconds. This tutorial will guide you how to create that program. Additionally, you will learn the use of few commands and wildcards. So lets start now!
Before moving to the steps, first let me introduce you with batch programming. In short words, Batch is a scripting language which works in Windows, DOS and OS 2 platform and can be programmed in notepad or simply in windows command prompt shell. It consist of simple commands to be executed by command line interpreter. The file extension type of batch program is '.bat'. Now to create this program, you've to do some programming in batch language. Don't worry! I had already created this code for you. Simply copy this and then proceed with below steps.
Apart from these commands, I had also used asterisk wildcard (*). Asterisk can be replaced by any word, number, symbol or combination. In ren command, it will select all files and then change them to your desired format. However, there file name will remain same because of third asterisk wildcard. (See above code and ren command syntax) Still don't get it? Ask me in comment box.
One more important thing in above program is "%a%" and "%b%". As already explained, set command will take input from user and then save it in variable. Now to print that input we have to put it under question marks as like this %a% Basically, a and b are the variables from set command which will be printed in cd and ren commands respectively. Now I just hope that you've complete knowledge about this code.
First of all, copy all files whose format you want to change and paste them in new folder. After that, open the batch program. It will display a welcome note as shown in below picture -
Now type the folder location where all files are saved. For example, "C:\Users\Username\Desktop\Test". You can find your folder location from its address bar.
After this, write the new extension type without dot like - "PNG" (without dot symbol). Finally hit enter button and see the magic.
Below is the simple preview of output -
Many of you may be wondering that where this tricks can be helpful. My answer is, you can use it anywhere like to change the image formats which were created by your camera. Sometimes particular format files are acceptable by any software or online tool. This batch program will reduce your hand-work and you can easily do your job within few seconds.
Now its your turn to try this. If you have any question, please let me know in below comment box. For more interesting tutorials, stay connected. Love and blessings!
After a deep study of 1 hour, I was successful in creating a small batch program that can help you to change multiple file formats in just few seconds. This tutorial will guide you how to create that program. Additionally, you will learn the use of few commands and wildcards. So lets start now!
Steps to Create Batch Program
Before moving to the steps, first let me introduce you with batch programming. In short words, Batch is a scripting language which works in Windows, DOS and OS 2 platform and can be programmed in notepad or simply in windows command prompt shell. It consist of simple commands to be executed by command line interpreter. The file extension type of batch program is '.bat'. Now to create this program, you've to do some programming in batch language. Don't worry! I had already created this code for you. Simply copy this and then proceed with below steps.
@echo off title change multiple file extensions at once color 0 echo Welcome to this program set /p a=Please enter the folder location where all files are saved: echo Wait! cd %a% set /p b=Now enter the new format you wish to change - rename *.* *.%b% echo Done! Your format has been successfully changed! pause>nul echo Press any key to exit this program pause>nul exit
- First of all, open notepad by searching it from start menu. If you've notepad++ then use it instead of older version.
- Now copy above code inside notepad editor and press "CTRL+S" keyboard shortcut key to save it. Alternatively, you can click on "File>Save as" button.
- After this, save dialog box will appear. From here choose the location where you want to save the file (say I choose desktop) and type your file name with ".bat" as suffix. For example, "batchprogram.bat". Here "batchprogram" is file name and ".bat" is extension type. Without extension type, your program will not work.
- Finally hit "Save" button and that's it.
Command | Explanation |
---|---|
echo | echo is used to print text |
title | This will add title to your program |
color 0a | This is used to set background and text color |
set /p | It will get input from user and then save it in variable. |
pause>nul | This command will pause screen until user press any key. |
exit | This will exit the program. |
Apart from these commands, I had also used asterisk wildcard (*). Asterisk can be replaced by any word, number, symbol or combination. In ren command, it will select all files and then change them to your desired format. However, there file name will remain same because of third asterisk wildcard. (See above code and ren command syntax) Still don't get it? Ask me in comment box.
One more important thing in above program is "%a%" and "%b%". As already explained, set command will take input from user and then save it in variable. Now to print that input we have to put it under question marks as like this %a% Basically, a and b are the variables from set command which will be printed in cd and ren commands respectively. Now I just hope that you've complete knowledge about this code.
How to Execute This Program
First of all, copy all files whose format you want to change and paste them in new folder. After that, open the batch program. It will display a welcome note as shown in below picture -
Now type the folder location where all files are saved. For example, "C:\Users\Username\Desktop\Test". You can find your folder location from its address bar.
After this, write the new extension type without dot like - "PNG" (without dot symbol). Finally hit enter button and see the magic.
Below is the simple preview of output -
Many of you may be wondering that where this tricks can be helpful. My answer is, you can use it anywhere like to change the image formats which were created by your camera. Sometimes particular format files are acceptable by any software or online tool. This batch program will reduce your hand-work and you can easily do your job within few seconds.
Now its your turn to try this. If you have any question, please let me know in below comment box. For more interesting tutorials, stay connected. Love and blessings!
Leave A Comment