Skip to content

Batch Script Renaming Files

Learn how to rename files in Windows using the ren or rename command in Batch Script, with syntax and practical examples for bulk and individual file renaming.

Renaming Files

In Batch Script, you can rename files with the ren or rename command.

Syntaxbatch
RENAME [drive:][path][directoryname1 | filename1] [directoryname2 | filename2]

Examples

The following command will rename all text files to files with .bak extension.

rename *.txt *.bak

The following command will rename the file test-a.txt to test-b.txt.

rename "test-a.txt" "test-b.txt"
Navigation