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.

  • 1
    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

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"
  • great! it works! – reyes Nov 21 '11 at 19:30
  • 2
    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
  • 1
    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! – ᴍᴀᴛᴛ ʙᴀᴋᴇʀ Mar 26 '15 at 12:17
  • @HarryJohnston works fine for me (Windows 7 Pro SP1 x64) – cantsay Dec 22 '16 at 1:33

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.