最近,我遇到了一个问题,我必须将一堆Windows文件的(Windows)文件(file extension)扩展名从无扩展名更改为 .JPG。有人给我发了很多文件,但出于某种奇怪的原因,它们没有文件扩展名(file extension),即使它们是图像!将 .JPG 扩展名添加到文件末尾后,我就可以打开图像了。
您可能需要重命名文件扩展名的原因还有很多,因此我将向您展示如何在文件数量少时一次更改一个文件扩展名,或者在文件很多时批量重命名文件(batch rename file)扩展名。
如果您有一个没有扩展名的文件,Windows可能会为其分配一个通用图标。当您尝试打开它时,将弹出“打开方式”对话框,您将在其中获得可供选择的程序列表。(Open With)
显然,由于该文件没有文件扩展名(file extension),Windows无法确定应该由哪个程序打开它。如果要更改文件的文件扩展名(file extension),首先需要能够在Windows中看到(Windows)文件扩展名(file extension)s 。您可以通过转到我的电脑(My Computer)然后转到工具(Tools)和 文件夹(Folder)选项(Options)来执行此操作。
在 Windows 7 中,单击整理(Organize)按钮,然后单击文件夹和搜索选项(Folder and search options)。
在Windows 8中,您只需单击资源管理器中的查看(View)选项卡并选中文件扩展名(File name extensions)框。
转到“查看”(View)选项卡并向下滚动,直到看到“(option “)隐藏已知文件类型的扩展名(Hide extensions for known file types)”选项。继续并取消选中它。
如果文件根本没有扩展名,则可能不需要此步骤,但我将其包括在内,因为如果您尝试将文件类型(file type)从一种类型更改为另一种类型,那么您需要执行此操作。现在右键单击您的文件并选择Rename。
移动到名称的末尾并输入(name and type).XXX 或任何您想要的文件类型,即 .TXT 用于文本文件(text file),.XLS 用于Excel文件等。显然,文件必须具有原始来自那个程序,您也正在更改文件扩展名。就我而言,文本文件(text file)来自Excel,因此我添加了该扩展名。
如何批量重命名文件扩展名
那么如何一次重命名多个文件扩展名(file extension)呢?如果您的目录中充满了需要从 .PNG 更改为 .JPG 的文件,那么使用上述方法将需要很长时间才能完成此操作。幸运的是,有几种不同的方法可以一次更改多个文件的文件扩展名(file extension)。
命令行
对于熟悉命令行(command line)的人来说,有一个非常简单的命令可以用来执行非常简单的文件重命名任务。您可以在命令提示符(command prompt)处使用两个命令:ren 和rename。他们都做同样的事情,所以这只是你使用哪一个的偏好。
例如,如果您有一个包含一堆JPG(JPGs inside)的文件夹,并且您想将文件扩展名(file extension)更改为PNG,您可以输入以下命令:
ren *.jpg *.png
正如您在上面看到的,该命令将该目录中具有JPG 文件(JPG file)扩展名的所有文件更改为具有PNG 文件(PNG file)扩展名的文件。您可以从Microsoft 网站(Microsoft’s website)获取有关如何使用 ren 命令的更多信息。
批量重命名实用程序
如果命令行(command line)听起来令人生畏,那么有几个有用的文件重命名实用程序只需单击几下即可为您完成工作。我最喜欢的一个是批量重命名实用程序(Bulk Rename Utility),因为它是目前最全面的文件重命名实用程序。
是的,界面绝对是卡住的包,除非您从网站上阅读所有文档,否则这些选项几乎没有意义。但是,出于我们的目的,我们只需要担心右下角标有Extension (11)的框。(Extension (11))将其从相同(Same)更改为固定(Fixed),然后输入您想要的新扩展名。您会看到列表框(list box)会在您提交更改之前立即显示文件的新名称。单击重命名(Rename)按钮,就是这样。
我提到了这个工具,尽管它对于我们的目的来说有点过头了,因为它是一个非常棒的实用程序,如果他们想重命名数千张名称为DSC00x、IMG00x等的照片,有些人可能有兴趣学习它。
高级重命名器
另一个需要阅读才能弄清楚的好程序是Advanced Renamer。值得庆幸的是,这两个网站都有用户指南和教程。另外,我将在此处解释更改文件扩展名(file extension)的过程。安装后,继续并单击“添加(Add)”按钮以添加他们的文件或添加文件夹,这会将该文件夹中的所有文件添加到列表中。
现在,为了对该列表执行任何操作,您必须在左侧窗格(hand pane)中添加方法。您可以添加多种方法来执行复杂的文件和文件夹重命名。我们要单击Add Method,然后选择New Name。
现在继续在顶部的框中输入您想要的新扩展名,然后将底部的Apply to框更改为(Apply to)Extension而不是Name。
在文件列表中,您应该看到更新后的新文件名字段随着( New Filename)文件名或扩展名(file name or extension)的更改而更新。当您以您喜欢的方式正确完成后,请继续并单击“开始批处理( Start Batch)”按钮。
同样(Again),我给出了这些程序的最简单示例,但如果您愿意,您可以创建更复杂的重命名方案。如果您真的不关心所有额外功能,请查看最后一个除了更改文件扩展名(file extension)之外什么都不做的程序。
批量扩展更换器
如果您想要简单,Bulk Extension Changer就是适合您的程序。您所要做的就是三件事:首先,选择文件所在的文件夹,然后设置当前和替换扩展名,然后只需按下Go按钮。
唯一的选择是是否要包含子目录。在第二步中,您可以添加多个替换规则,以防您的文件夹中有许多不同类型的文件并且您想一次检查多个。
希望(Hopefully)这些选项足以满足您重命名文件扩展名的任何需求。如果您有任何问题,请随时发表评论。享受!
How to Batch Change File Extensions for Windows Files
Recently, I came across а problem where I had to change the file extension on a bunch of Windows files frоm no extension to .JPG. Someone sent me a large number of files, but for some strange reаson, they had no file extension, even though they were images! Once I added the .JPG extension to the end of the fіle, I was able to open the imageѕ.
There are many other reasons why you may need to rename file extensions, so I’ll show you how you can change them one at a time if you have a small number of files or batch rename file extensions if you have lots of files.
If you have a file with no extension, Windows will probably assign a generic icon to it. When you try to open it, the Open With dialog will pop up where you’ll get a list of programs to choose from.
Obviously, since there is no file extension for the file, Windows is not able to determine which program should open it. If you want to change the file extension for the file, you first need to be able to see file extensions in Windows. You can do this by going to My Computer and then going to Tools and Folder Options.
In Windows 7, click on the Organize button and then click Folder and search options.
In Windows 8, you just click on the View tab in Explorer and check the File name extensions box.
Go to the View tab and scroll down till you see the option “Hide extensions for known file types“. Go ahead and uncheck it.
If the file has no extension at all, this step may not be necessary, but I am including it because if you’re trying to CHANGE the file type from one type to another, then you need to do this. Now right-click on your file and choose Rename.
Move to the end of the name and type in .XXX or whatever the type is for the file you want it to be, i.e. .TXT for text files, .XLS for Excel files, etc. Obviously, the file has to have originally been from that program that you are changing the file extension too. In my case, the text file was from Excel, so I added that extension back.
How to Batch Rename File Extensions
So how do you rename multiple file extensions at once? If you have a directory full of files that need to be changed from .PNG to .JPG, it’s going to take forever to do this using the method above. Luckily, there are a couple of different ways we can change the file extension for multiple files at once.
Command Line
For those of you who are familiar with the command line, there is a very easy command you can use to perform very simple file renaming tasks. There are two commands that you can use at the command prompt: ren and rename. Both of them do the exact same thing, so it’s just a preference as to which one you use.
If you have a folder with a bunch of JPGs inside and you want to change the file extension to PNG, for example, you would type in the following command:
ren *.jpg *.png
As you can see above, the command changed all the files in that directory with a JPG file extension to ones with a PNG file extension. You can get more information on how to use the ren command from Microsoft’s website.
Bulk Rename Utility
If the command line sounds daunting, then there are a couple of useful file renaming utilities that will get the job done for you with only a few clicks. One of my favorites is the Bulk Rename Utility because it is the single most comprehensive file renaming utility out there.
Yes, the interface is absolutely jammed pack with options that make little to no sense unless you read all the document from the website. However, for our purpose, all we have to worry about is the box labeled Extension (11) down at the bottom right. Change it from Same to Fixed and then type in the new extension you want. You’ll see that the list box will show you the new name of the file instantly before you even commit the changes. Click the Rename button and that’s it.
I mentioned this tool even though it’s overkill for our purpose because it’s a really great utility and one that some might be interested in learning if they want to rename thousands of photos with names likes DSC00x, IMG00x, etc.
Advanced Renamer
Another good program that also requires a bit of reading to figure out is Advanced Renamer. Thankfully, both sites have user guides and tutorials. Also, I’ll explain the process for changing the file extension here. Once you install it, go ahead and click the Add button to add their files or to add a folder, which will add all the files in that folder to the list.
Now in order to perform any actions on that list, you have to add methods in the left hand pane. You can add multiple methods to perform complex renaming of files and folders. We want to click Add Method and then choose New Name.
Now go ahead and type in the new extension you would like into the box at the top and then change the Apply to box at the bottom to Extension instead of Name.
In the list of files, you should see the updated New Filename field updated with the changes to the file name or extension. When you have gotten it right the way you like, go ahead and click on the Start Batch button.
Again, I’m giving the simplest example with these programs, but you can create far more complex renaming schemes if you like. If you really don’t care about all the extra functionality, then check out the last program that does nothing but change the file extension.
Bulk Extension Changer
If you want simple, Bulk Extension Changer is the program for you. All you have to do is three things: first, pick the folder where the files are located, then set the current and replacement extension and then just press the Go button.
The only option is if you want to include sub-directories or not. In the 2nd step, you can add multiple replacement rules in case your folder has files of many different types and you want to check several at once.
Hopefully, those are enough options for any need you might have for renaming file extensions. If you have any questions, feel free to post a comment. Enjoy!