Batch suppress "Connection to host lost"

0

I am using the BOFH server to get random excuses, however whenever it runs it states "Connection to Host Lost" after it has run, since the server immediately disconnects (expected behavior). How can I supress this message?

Running telnet towel.blinkenlights.nl 666 2>nul does nothing.

And the following script does not output anything:

set num=0    
for /f "tokens=*" %%A in ('telnet towel.blinkenlights.nl 666') do (
    set /a num+=1
    echo %%A
    if "!num!"=="3" exit /b

)

Mark Deven

Posted 2019-04-03T21:35:39.203

Reputation: 1 101

Is there is head on windows? – Eugen Rieck – 2019-04-03T22:07:48.667

Yes it has a head display – Mark Deven – 2019-04-03T22:15:53.847

The command head that shows only the first n lines of output ... – Eugen Rieck – 2019-04-04T07:21:26.563

What? I don’t understand what you’re trying to say. Maybe say it in your natural language? – Mark Deven – 2019-04-04T12:58:51.683

@EugenRieck no, head doesn't exist on Windows. – shawn – 2019-04-27T05:03:18.757

@MarkDeven have you tried redirecting error output to NUL? for /f "tokens=*" %%A in ('telnet towel.blinkenlights.nl 666 ^2>NUL') ... – shawn – 2019-04-27T05:04:10.607

Yes. Whenever I tried using NUL it either changes nothing or redirects all output. – Mark Deven – 2019-04-27T11:30:38.450

No answers