The easiest way to change a file's extension is to save the file as a different file type from within a software program. Changing the file extension in the file name won't change the file type, but will cause the computer to misidentify the file. In Windows and Mac OS X, file extensions are often hidden. The file extension is the part of the file name after the period. For example, to convert a JPEG (.jpg) file into a Bitmap file (.bmp): original file: image.jpg. New file: image.bmp. Click Save, and a new file will be saved in the new format. The old file (in the old format) will remain where it was, and will not be deleted.
It’s easier to change filenames in Vista and Windows 7 than in previous versions of Windows. All you do is:
- Click the file to select it, then click once more. Windows automatically selects the filename so that anything you type will replace the existing name.
- Type the new filename and press Enter. You’re done.
It’s a small change from the previous method, where you had to manually select the filename before editing, but it saves a lot of time.
To change a whole batch of files at once:
- Select each of the files. You can select a group of contiguous files by click the first one and then Shift+clicking the last one; you can select any number of files by Ctrl+clicking each file; or to select all files in a folder, press Ctrl+A.
- Press F2. The filename of the last file you clicked will be selected.
- Type a new name and press Enter.
Each of the files will be renamed, with sequential numbering used to distinguish one file from another.
So, for example, if you select three .jpg image files and rename the first one Dad’s Birthday, you’ll end up with files named
Dad’s Birthday (1).jpg
Dad’s Birthday (2).jpg
Edit File Extension Windows 10
Dad’s Birthday (3).jpg
|
Unfortunately, this new file renaming method has one drawback: although the new method makes changing filenames easy, it makes it harder to change the file extension. The problem is exacerbated by Microsoft’s determination to hide those file extensions from view.
|
First, display file extensions
Microsoft has been hiding file extensions from users in version after version of Windows. This supposedly makes things less confusing; in fact, it’s a piece of paternalistic boneheadedness. Being able to see file extensions is a good thing.
- Those extensions tell you the type of file you’re dealing with and which type of program you’ll need in order to view or edit the file.
- The extensions help you distinguish between similarly named files. For example, if you have an Excel spreadsheet named 4th Quarter Budget and a PowerPoint presentation also called 4th Quarter Budget, seeing the .xls extension on the spreadsheet and the .ppt extension on the presentation helps you see which is which at a glance. Yes, the little file icons help, too, but those icons aren’t always easily identifiable.
- The extensions also help you spot files which may be dangerous to open. A .vbs extension tells you you’re about to open a Visual Basic script which will run commands on your computer – one way that malware can strike. Similarly, seeing the .exe extensions lets you know you’re dealing with a program. If you receive an attachment in your email and see the .exe extension, you almost always want to avoid opening it, once again to avoid malware.
- The file extensions can also help you figure out why you can’t view or edit a file. Not everyone uses the same software nor the same operating system. If someone sends you a document they created using Pages on an Apple Mac, there’s a good chance you won’t be able to open that document on your Windows system; if you can’t see the file’s extension, there’s no way of knowing it’s a Pages document and thus it’s hard to figure out why you’re having problems. On the other hand, if you see the .pages file extension you’ll know immediately you’re dealing with some strange, other worldly animal. You can then ask your correspondent to save the file in Word or some other format and resend it.
- The file extensions help you recognise which version of a Microsoft Office document you’re dealing with. Office 2010 saves Word documents as .docx files, Excel documents as .xlsx files, an so on. In earlier versions of Office, those extensions were .doc and .xls. The new formats are incompatible with the old, so if someone sends you a .docx document and all you have is Word 2003, you won’t be able to open or edit the file. Being able to see the extension will help you troubleshoot why you’re running into this problem.
With all those reasons why displaying file extensions is a good thing, let’s look at why hiding them is a good thing:
- It makes for less clutter on the screen.
Really, that’s it. Microsoft may think it makes for less confusion, but the reverse is true.
It’s pretty clear by now that Microsoft is unlikely to see the light and display file extensions by default in any version of Windows. That doesn’t matter because you can take charge of the situation yourself and turn extension display on:
- Open any folder window.
- Press Alt+T+O (that’s the letter O, not a zero) to open the Folder Options dialog box.
- Click the View tab.
- Remove the tick (checkmark) beside ‘Hide extensions for known file types’ and click OK.
Change File Extension Powershell
Why change a file extension?
If Windows uses a file’s extension to determine how to open that file, why would you ever want to change an extension? Wouldn’t that simply confuse Windows and prevent it from opening the file?
In many cases, that’s true. Most of the time, you’ll want to leave extensions alone. But there are times when it’s useful to be able to change those extensions. If you use a text editor to create a web page, you may want to keep the .txt extension while editing the code but then change the extension to .html to be able to view the page in a web browser.
Occasionally, you may receive a file which has the wrong extension: a .jpg image which someone has accidentally named as a .bmp file, for example. If you try to load a .jpg file into your graphics program and you get an “invalid file format” or similar message, try changing the extension to .bmp or .png or .tif or another common graphics file extension, and see if your graphics editor recognises it.
You may also want to change the case of an extension. Many cameras save image files with a capitalised extension, such as .JPG. Windows is case-blind when it comes to filenames, so it doesn’t matter to the operating system whether a file is called MAGNOLIA.JPG or magnolia.jpg, but it may matter to humans; after all, using ALL CAPS is the digital equivalent of shouting at someone, and a folder littered with .JPG images does just that.
How to change a file extension
In Windows 7, to change a file extension, first, make sure file extensions are visible using the steps above, then:
- Click the file to select it, then click once more. Windows automatically selects the filename so that anything you type will replace the existing name.
- Click and drag over the extension, type the new extension and press Enter.
It sounds simple enough, but it turns out to be pretty clumsy, especially if you’re changing extensions on a bunch of files.
Things get even worse if you want to change capitalised extensions on a group of files: Windows 7 refuses to do it. For example, if you have three files named 1.JPG, 2.JPG and 3.JPG, if you select all the files and rename the first one platypus.jpg, you’ll end up with platypus (1).JPG, platypus (2).JPG and platypus (3).JPG. The extension pigheadedly maintains its uppercase lettering. If you want to change those extensions, you have to rename each file one by one.
A better way to change filenames and extensions
If you need to do some serious file renaming – perhaps you have folders stuffed with horribly named photos – try a bulk file renaming utility. There’s one called Bulk Rename Utility that’s free to use. It looks pretty ferocious when you open it up, but don’t worry – although it has enormous power and flexibility, it makes very light work out of actions such as changing the case of a bunch of file extensions. If you want a less intimidating renamer, Better File Rename does the trick, but it’ll set you back $US19.95.
Here’s how you change the case of all files in a folder using Bulk Rename Utility:
- Open the folder containing the files.
- Right-click any file in the folder and choose Bulk Rename Here from the context menu. The utility will load all the files into its main window, with a folder tree displayed on the left allowing you to navigate to any other folder, and a mind-numbing array of options displayed below.
- Press Ctrl+A to select all the files in the folder.
- Down near the bottom right of the window you’ll see Extension. Select Lower from the Extension drop-down box. You’ll see the filenames updated in the New Name column. This is a preview to let you check whether the changes you’re making are correct.
- If you’re satisfied with the displayed changes, click the Rename button in the bottom right to rename the selected files.
A quick look at Bulk Rename’s other options gives you an idea of the power of the program. You can even save renaming schemes so that you can reapply them to other batches of files.
|
This post talks about how to batch rename file extensions from command line. No 3rd party tools are required. At the end of the post, you can find a download link for the batch file script.
Batch rename file extensions in bulk from CMD
We can change the extension of files in batch using rename command. For example, let’s say you have set of files with extension .log and you want to rename them to .txt. You can do this with the below command
The drawback with this command is, we can’t use it to rename file extensions recursively in the sub folders. Next, we’ll look at a solution which allows us to do so.
Recursively batch rename file extensions
Change File Extension
If you want to rename files from one extension to another, recursively in all sub folders, then you can use the below command.
For example, if you want to rename all xml files to txt files, the command would be as below
Remove file extensions in batch
The below command would remove extension for the specified file types.
If you want a batch file script, it can be downloaded from the below link:
Batch file script for renaming file extensions in bulk
Change File Type
Add prefix to file names in batch
If you want to add any prefix to file names, it can be done as in the below example. Here we try to add ‘photo’ to every jpg file in the current folder and subfolders.
Similarly, we can add a number to a file name.
Handling names with white spaces
If the new name you want to assign to the files has white space within it, it can be done by adding double quotes around the file name. So that forfiles does not misinterpret this doublequotes, you need to escape them with ‘’
For example to add ” – pic.jpg” to each of the jpg files, the command would be as below.