It gives me this error: 2> was unexpected at this time.
Escape the '>' in the same way that you escaped the '|'.
C:\test>for /f "tokens=*" %a in ('prel -v 2^>nul ^| find "perl"') do @
C:\test>for /f "tokens=*" %a in ('perl -v 2^>nul ^| find "perl"') do @
This is perl, v5.10.1 built for MSWin32-x64-multi-thread
(with 2 registered patches, see perl -V for more detail)
this system using "man perl" or "perldoc perl". If you have access to
Internet, point your browser at http://www.perl.org/, the Perl Home Pa