I am using windows 10 and would like to rename a number of files which are in the directory C:\temp\bildgroesse. The files are named test1.tif, test2.tif and so on.

So I wrote the command line:

cd \temp\bildgroesse
rename C:\temp\bildgroesse\ *.tif *-org.tif

I also tried :

cd \temp\bildgroesse
rename C:\temp\bildgroesse\ * *-org

The result is in both cases:test1.tif_org.tif,test2.tif_org.tif and so on. So Windows takes the extension as filename.

Does anyone know how to solve this problem?


Your formulation used to work in previous versions of Windows, so I would really define it as a new bug in Windows 10.

You could instead use the forfiles command like this :

forfiles /M *.tif /C "cmd /c ren @file @fname-org.tif"

You should use the forfiles solution, but this is how to add a string to a file name before its extension using only the rename command.

ren *.ext ????????????string.ext

So in your case, you would use

cd \temp\bildgroesse
ren *.tif ????????????-org.tif


  • This does not work the same if a file has more than one . in its name. The question mark wildcard matches a single character as long as that character is not ., so only the characters before the first . will appear in the new file name. The forfiles solution has no such restriction.

  • The number of question marks needs to be greater than or equal to the length of the longest file name (without its extension).

  • Once you cd to a directory, you do not need to type out the full path to the files. Alternatively, if you type out the full path, you do not need to cd.

  • ren is an alias for rename.

More information on ren/rename, including wildcard usage, can be found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.