I have a java properties file to parse, it contains key value pairs of the form key=value, one on each line. After digging around on the site, I've found this site that explains the FOR syntax, and also this question.
I constructed the following line to get the value of the backupdir.windows property in config.properties:
for /f "delims== tokens=2" %i in ('findstr backupdir.windows= config.properties') do @echo %i
The above works if you type it at the command prompt, but if I save it as a file 'test.cmd' and then execute that, I get 'i was unexpected at this time.' Same thing happens if I change the extension to .bat (in case doing so would make it use earlier MSDOS syntax).
What's going wrong here? I'm running Windows 7.