What does > nul 2>&1 mean in a batch statement

Don’t use a redirection operator, which is what “>” is.

All programs have three streams:

  • Standard Input (the input from the console)
  • Standard Output (general logging/UI output to the console)
  • Standard Error (logging/UI output to the console meant for error messages or other exceptional behavior)

command >nul

^ This says to pipe the standard-output stream to null.

command 2>nul

^ This says to pipe the standard-error stream to null.

command 2>&1

^ This says to pipe the standard-error stream to the same place as the standard-output stream.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)