redirect

P

Praetorian Guard

The following code snippet can be used to detect if FINDSTR is available:

FINDSTR /? >NUL 2>&1
IF ERRORLEVEL 1 ECHO FINDSTR not available!What does 2>&1 mean?Thanks in
advance.
 
F

foxidrive

The following code snippet can be used to detect if FINDSTR is available:

FINDSTR /? >NUL 2>&1
IF ERRORLEVEL 1 ECHO FINDSTR not available!
What does 2>&1 mean?

It means to direct the STDERR stream (2) to the same place that the STDOUT
stream (1) is going.

In your example STDOUT is redirected to NUL and so the snippet redirects
STDERR to NUL also.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top