Changing all files' extensions in a folder with one command on Windows

后端 未结 11 1859
南方客
南方客 2020-12-07 08:00

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

11条回答
  •  长情又很酷
    2020-12-07 08:38

    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.

提交回复
热议问题