在Windows上使用一个命令更改文件夹中的所有文件扩展名 [英] Changing all files' extensions in a folder with one command on Windows
问题描述
如何使用Windows命令行将成千上万个文件的扩展名更改为 *****。jpg
?
ren
(如 rename 中的): ren * .XXX * .YYY
b $ b
当然,请为适当的扩展名切换XXX和YYY。它会将从 XXX 更改为 YYY。如果您要更改所有扩展程序,只需再次使用通配符:
ren *。* * .YYY
使用 FOR
命令递归执行此工作的一种方法。它可以与 / R
选项一起使用,以递归方式将命令应用于匹配的文件。例如:
for(* .txt)do ren%x* .renamed
会将所有 .txt
的扩展名更改为 .renamed
递归,从当前目录开始。
%x
是保存匹配文件名的变量。
的文件,请务必等到光标再次闪烁,表示其已完成工作。
How can I use the Windows command line to change the extensions of thousands of files to *****.jpg
?
You can use ren
(as in rename):
ren *.XXX *.YYY
And of course, switch XXX and YYY for the appropriate extensions. It will change from XXX to YYY. If you want to change all extensions, just use the wildcard again:
ren *.* *.YYY
One way to make this work recursively is with the FOR
command. It can be used with the /R
option to recursively apply a command to matching files. For example:
for /R %x in (*.txt) do ren "%x" *.renamed
will change all .txt
extensions to .renamed
recursively, starting in the current directory.
%x
is the variable that holds the matched file names.
And, since you have thousands of files, make sure to wait until the cursor starts blinking again indicating that it's done working.
这篇关于在Windows上使用一个命令更改文件夹中的所有文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!