tags:

views:

121

answers:

1

for /f %%i in ('someprogram %1 2>&1 | find /c "some string"') do ...

it says

2>&1 was unexpected at this time

+2  A: 

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.

Joey