Tim Chase wrote:
To do an operation on multiple files in a WinXP DOS batch:

  for %%A in (*.txt) do [command]

Just a small caveat to the reader, this works within a batch file by escaping the variable ("%A" in this case). If you're running it from the command-line, you don't escape it, and thus use

    for %a in (*.txt) do [command using %a]

instead of

    for %%a in (*.txt) do [command using %%a]

Then again, maybe I'm among the freakish few that actually use for-loops at the dos-prompt. :)

-tim

I have used them too, starting (in my case) with Dos 3.1. Your warning is valid on old DOS shells, and is regarded as "good form" writing by old hands like me, but IIRC, with "modern" versions of CMD.EXE, and with NDOS.EXE, 4DOS.EXE or 4NT.EXE, you may use either %a or %%a in either the command line or a batch file.



Best regards,
Tony.

Reply via email to