Batch renaming files in Windows.

command-line windows

I don’t do any development work on Windows. When a collaborator asked me how to rename a bunch of files on Windows, I didn’t know how to do it.

Thankfully, there’s an easy way with the command line – source is

I was mostly interested in adding a prefix. Here, all of the .jpg files in a directory and its subdirectories are renamed, with a prefix added to the filename of 03-21.

forfiles /S /M *.jpg /C "cmd /c rename @file 03-21-@file"

© Amy Tabb 2018 - 2023. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.