Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a batch file that tests a Computer name and sees if it responds.

However when I run it, even with the "@echo off", I still see the reply being sent and so on. How can I hide that?

share|improve this question
up vote 4 down vote accepted

redirect the output to nul:

ping -n 1 %computer_name%  | find "Reply" > nul

this will still correctly set the %errorlevel% if the string was or was not found, but also hide the output.

share|improve this answer
And, in most cases, just to be sure, stick a 2>&1 at the end as well. Many programs (ping and find apparently not) emit error messages to stderr. – Joey Oct 21 '09 at 6:26
@Johannes Rössel: No. This is DOS, not Unix. – Teddy Oct 21 '09 at 9:11
Surely it's "nul:", not "nul"? – Teddy Oct 21 '09 at 9:12
I think people use nul: because files cannot be created with a colon in their name on Windows, so it will revert to nul by itself. Even an example from Microsoft on how to invoke DOS commands uses nul by itself: – John T Oct 21 '09 at 11:48
Thank You sir! Great Success (*With borat accent) – thegreyspot Oct 22 '09 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .