1.

Solve : Attempting to use FOR in DOS .bat file?

Answer»

I have numerous file in the current directory (FILE.1.txt, FILE.1.txt, FILE.3.txt, etc.) and am attempting to use the FOR COMMAND in a .bat file as follows:

   FOR /F %%FILE IN ("FILE.*.txt") DO JAVA -CP .;../. myJavaClass CONSTANT %%~nxFILE %%~nFILE.tmp %%~nFILEout.txt

passing various forms of the filename as parameters to the Java class. Unfortunately, this FAILS with the message:

   %FILE was unexpected at this time.

Thanks in advance for any help you may be able to provide. Quote

%%FILE

FOR variables can only be single letters (A-Z, a-z, case sensitive). Type FOR /? at the prompt to see the documentation.



Discussion

No Comment Found