Changing all files' extensions in a folder wit

2019-01-29 18:01发布

How can I use the Windows command line to change the extensions of thousands of files to *****.jpg?

标签: windows cmd jpeg
8条回答
成全新的幸福
2楼-- · 2019-01-29 18:25

thats simple

ren *.* *.jpg

try this in command prompt

查看更多
小情绪 Triste *
3楼-- · 2019-01-29 18:29

NOTE: not for Windows

Using ren-1.0 the correct form is:

"ren *.*" "#2.jpg"

From man ren

The replacement pattern is another filename with embedded wildcard indexes, each of which consists of the character # followed by a digit from 1 to 9. In the new name of a matching file, the wildcard indexes are replaced by the actual characters that matched the referenced wildcards in the original filename.

and

Note that the shell normally expands the wildcards * and ?, which in the case of ren is undesirable. Thus, in most cases it is necessary to enclose the search pattern in quotes.

查看更多
干净又极端
4楼-- · 2019-01-29 18:30

Just for people looking to do this in batch files, this code is working:

FOR /R "C:\Users\jonathan\Desktop\test" %%f IN (*.jpg) DO REN "%%f" *.png

In this example all files with .jpg extensions in the C:\Users\jonathan\Desktop\test directory are changed to *.png.

查看更多
Animai°情兽
5楼-- · 2019-01-29 18:39

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.

Note: this works only on cmd. Won't work on Powershell or Bash

查看更多
叛逆
6楼-- · 2019-01-29 18:39

on CMD

type

ren *.* *.jpg

. will select all files, and rename to * (what ever name they have) plus extension to jpg

查看更多
三岁会撩人
7楼-- · 2019-01-29 18:44

Rename multiple file extensions:

You want to change ringtone1.mp3, ringtone2.mp3 to ringtone1.wav, ringtone2.wav

Here is how to do that: I am in d drive on command prompt (CMD) so I use:

d:\>ren *.* *.wav 

This is just an example of file extensions, you can use any type of file extension like WAV, MP3, JPG, GIF, bmp, PDF, DOC, DOCX, TXT this depends on what your operating system.

And, since you have thousands of files, make sure to wait until the cursor starts blinking again indicating that it's done working.

查看更多
登录 后发表回答