for /f %%i in ('someprogram %1 2>&1 | find /c "some string"') do ...
it says
2>&1 was unexpected at this time
for /f %%i in ('someprogram %1 2>&1 | find /c "some string"') do ...
it says
2>&1 was unexpected at this time
You will need to escape special characters within the for
command:
for /f %%i in ('someprogram %1 2^>^&1 ^| find /c "some string"') do ...
cmd
's parser is not the most robust one; this is unfortunately necessary.