如何使用Windows批处理脚本将扩展更改为目录中的所有文件

时间:2020-11-26 02:23:48

I need to change the file extensios of a directoy. If I do it manually so it will take more time. So is there any windows shell command or batch file to do this? Like all .html file in a folder will be .php?

我需要更改directoy的文件扩展名。如果我手动完成,则需要更多时间。那么有没有任何Windows shell命令或批处理文件来执行此操作?像文件夹中的所有.html文件一样.php?

2 个解决方案

#1


2  

make a .bat in a folder and put in it this code

在文件夹中创建一个.bat并将此代码放入其中

@ren *.Old_extension *.New_Extension

Also if you want to change more extensions just copy the lane and paste it under edited like this

此外,如果您想要更改更多扩展名,只需复制通道并将其粘贴到此处编辑下

@ren *.Old_extension *.New_Extension
@ren *.Old_extension2 *.New_Extension2

#2


1  

Yes, You can easily do this Command Prompt Suppose, You have a Folder so many .TXT files in your folder.

是的,您可以轻松地执行此命令提示假设您的文件夹中有一个文件夹这么多.TXT文件。

Open that folder and just press SHIFT + RIGHT click and select Open Command Windows here

打开该文件夹,然后按SHIFT + RIGHT单击并在此处选择打开命令窗口

After that type the following command to change all .txt file to .doc

之后键入以下命令将所有.txt文件更改为.doc

ren *.txt *.doc

ren * .txt * .doc

It will change all text files in doc file That's all

它将更改doc文件中的所有文本文件

#1


2  

make a .bat in a folder and put in it this code

在文件夹中创建一个.bat并将此代码放入其中

@ren *.Old_extension *.New_Extension

Also if you want to change more extensions just copy the lane and paste it under edited like this

此外,如果您想要更改更多扩展名,只需复制通道并将其粘贴到此处编辑下

@ren *.Old_extension *.New_Extension
@ren *.Old_extension2 *.New_Extension2

#2


1  

Yes, You can easily do this Command Prompt Suppose, You have a Folder so many .TXT files in your folder.

是的,您可以轻松地执行此命令提示假设您的文件夹中有一个文件夹这么多.TXT文件。

Open that folder and just press SHIFT + RIGHT click and select Open Command Windows here

打开该文件夹,然后按SHIFT + RIGHT单击并在此处选择打开命令窗口

After that type the following command to change all .txt file to .doc

之后键入以下命令将所有.txt文件更改为.doc

ren *.txt *.doc

ren * .txt * .doc

It will change all text files in doc file That's all

它将更改doc文件中的所有文本文件