Search code examples
cmdrename

Rename files Using the command RENAME in MS-DOS


I want to know if there is any way to rename files in windows through the interpreter MS-DOS command as follows:

Suppose I have a directory with files in the following way:

file1.mp3
file2.mp3
file3.mp3
.
.
.
filen.mp3

and I want to rename as

author-file1.mp3
author-file2.mp3
author-file3.mp3
.
.
.
author-filen.mp3

where n is the number of songs and author is the same for all songs.

I read about the command to rename files in MS-DOS, more specifically RENAME but I can not create the proper syntax to do so.

I have an idea that might be something like:

RENAME *. mp3 author-<song_name>. mp3

I don't know how to specify MS-DOS to place the names above each of the mp3 files so that they are as:

author-file1.mp3
author-file2.mp3
author-file3.mp3
.
.
.
author-filen.mp3

I hope someone can help me,


Solution

  • for %f in (*.mp3) do rename %f author-%f
    

    REF: Microsoft Batch Help