Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows XP: how do I add 00 in front of every file via command prompt?

I tried REN * 00*.gif but it doesn't work.

share|improve this question
I know this isn't exactly what you've asked for but there is a program called Bulk Rename Utility that does this and a lot more. I see someone has already answered how to do this via command prompt so you should be set that way :) – victoroux Nov 21 '11 at 19:21
up vote 8 down vote accepted

If you really want to rename everything:

for %a in (*.*) do ren %a 00%a

If you only want to rename .gif files:

for %a in (*.gif) do ren %a 00%a

If you need to add the prefix to file names with spaces in them put quotes around the %a and 00%a at the end of the line, i.e.

for %a in (*.*) do ren "%a" "00%a"
share|improve this answer
great! it works! – reyes Nov 21 '11 at 19:30
For future reference: this works properly on Windows XP but not on Windows 7; one of the files will be double-renamed (so x.gif would become 0000x.gif in this case). The easiest workaround is to create a new directory and use move instead of rename: move %a x\00%a – Harry Johnston Nov 21 '11 at 20:37
I'm not seeing the double rename problem on Windows 8, maybe they fixed it – jjxtra Nov 13 '12 at 15:42
Works great! Now to find the undo option... Doh! – Matt Baker Mar 26 '15 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .