Is there a command to supress error messages in a batch script?

I have written a small script to delete a printer and want to use it as a logon script the only problem is that some of the computers dont have this printer and then gets prompted with an error message. Is there a way to suppress this. Thanks

2 Responses to “Is there a command to supress error messages in a batch script?”

  • LoverOfWine:

    Stdout comes out on ">" but stderr (your error messages) come out on "2>"

    mycommand 2> nul

    the above would just toss any errors (wouldn’t be visible).

  • lansingstudent09101:

    you should be able to use the @ sign at beginnings of lines to suppress output.

    Also
    @echo off

    should suppress all output thereafter from the script…

    if that doesn’t work, just redirect the output to a file

    echo "hello" > file.txt

    or

    errorcausingcommand > file.txt

Leave a Reply