Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to make ping less verbose for my batch script, but I do want it to show time-out messages and other errors.

This is what I've got so far:

@echo off

:BEGIN

time /T
ping 127.0.0.0 -n 1 | find "TTL" 
ping 127.0.0.1 -n 1 | find "TTL"
ping 1.1.1.1 -n 1 | find "TTL"
sleep 10s

GOTO BEGIN

This works, but it is hard to spot the errors on 127.0.0.0 and 1.1.1.1 that give an error message and a time-out message. (I mostly care about the time-out actually).

Is there any way to make find filter lines with time out and TTL, or perhaps another trick i can use?

share|improve this question
    
Well for a start, the sleep command doesn't work, making your script as written behave very badly indeed. Use 'timeout' instead. –  toryan Aug 27 '13 at 18:20
    
You could always force it to write to a file then filter it that way? –  TKEyi60 Aug 27 '13 at 18:39
    
Yeah, i'll probably end up programming something in a real programming language. Never realised batch scripts where so limited. –  Dorus Aug 27 '13 at 23:47
    
Also, what is wrong with the sleep command? It works just fine here. –  Dorus Aug 28 '13 at 10:34
    
Nvm, sleep seems to be something i have installed here, i'm not sure if it's suposed to be there by default on windows 7, but it wasn't present on my windows vista box. –  Dorus Aug 28 '13 at 11:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.