1

I was looking at this post: Is there a way to batch rename files to lowercase?

and I tried to use it in a textfile, renaming the extention into .bat, then running it at the directory. But, the title error popped up, and nothing happened. Any guesses on why this is happening?

4
  • check the quotes, it looks that your editor changed them.
    – wmz
    Jun 17, 2014 at 21:26
  • @wmz If you're talking about the recursive version, I tried them both and neither of them worked. EDIT: I see what you mean, but it seems fine to me
    – Piofmc
    Jun 17, 2014 at 21:27
  • no - in your title there are different types of quotes ('inverted' and 'straight' quotes). Plus, the version shown in the linked answer should be run directly form command line, not as batch file (if you want to run it from batch, replace %f with %%f
    – wmz
    Jun 17, 2014 at 21:34
  • @wmz Hm. It says the syntax of the command is incorrect.
    – Piofmc
    Jun 17, 2014 at 21:43

1 Answer 1

1

Using the FOR command in a batchfile works slightly different, because batchfiles themselves use %? variables. For that reason the FOR command requires its parameter to be %%? to work.

If you enter FOR /? from a commandline, the help will tell you this as well.

So the following FOR command would be the following in a batch file:

in cmd:

for %i IN (*.*) DO echo %i

in file.bat:

for %%i IN (*.*) DO echo %%i

You must log in to answer this question.

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