Search code examples
batch-filecmdbatch-renamewindows-10-desktop

Rename multiple files at once using cmd [Windows 10]


I want to rename multiple files using command prompt / batch script (as such cases often arise where I need to rename multiple files)

from - quiz-1.png, quiz-2.png, quiz-3.png, .., .., quiz-20.png

to 15-quiz-1.png, 15-quiz-2.png, ... 15-quiz-20.png

I tried: ren *.* 15-?*.* But this is resulting in renaming files as "15-z-1.png, 15-z-2.png,...."


Solution

  • From the command prompt.

    for %G IN (quiz-*.png) do rename %G 15-%G
    

    Double the percent symbols if you are using this code in a batch file.