Pingtest + Fehler in der .bat-Datei

Gast #3737725
Lesenswert?

Hallo,
ich möchte einen Ping auf 2 verschiedene url's durchführen und beide in 
ein Textfile mitloggen lassen.
Das könnte dann so aussehen. Es wird also z.B. alle 10s der Ping auf die 
eine und die andere url gemacht
und dann immer in das gleiche .txt geschrieben.


07/23/2014 22:59:42 Reply from 173.194.116.175: bytes=32 time=46ms 
TTL=56
07/23/2014 22:59:42 Reply from 173.194.116.3: bytes=32 time=46ms TTL=56
07/23/2014 22:59:52 Reply from 173.194.116.175: bytes=32 time=46ms 
TTL=56
07/23/2014 22:59:52 Reply from 173.194.116.3: bytes=32 time=46ms TTL=56
Request timed out.
07/23/2014 22:59:72 Reply from 173.194.116.175: bytes=32 time=46ms 
TTL=56
usw.

Die .bat Datei funktioniert so leider nicht.
1
@ECHO OFF
2
:LOOPSTART
3
time /T >> D:\pingtest\filename.txt
4
ping google.de -n 4 >> D:\pingtest\filename.txt
5
ping msn.de -n 4 >> filename.txt
6
sleep -m 10000 (10 Sekunden Wartezeit)
7
GOTO LOOPSTART

Ich würde mich freuen, wenn hier jemand evtl. ne einfache Lösung hat.

Gruß
Gast #3737780
Lesenswert?

...er macht also jeweils 4 pings und dann die lästige statistik 
dazwischen.
Ausserdem schreibt er den Timestamp nicht direkt in jede Zeile.
Zudem erscheint in der DOS Ausgabe der Fehler
"sleep is not recognized as an internal or external command, operable 
program or batch file."

Bei mir sieht das File "filename" also so aus:
1
11:58
2

3
Pinging google.de [173.194.116.191] with 32 bytes of data:
4
Reply from 173.194.116.191: bytes=32 time=48ms TTL=56
5
Reply from 173.194.116.191: bytes=32 time=46ms TTL=56
6
Reply from 173.194.116.191: bytes=32 time=46ms TTL=56
7
Reply from 173.194.116.191: bytes=32 time=46ms TTL=56
8

9
Ping statistics for 173.194.116.191:
10
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
11
Approximate round trip times in milli-seconds:
12
    Minimum = 46ms, Maximum = 48ms, Average = 46ms
13

14
Pinging msn.de [94.245.115.230] with 32 bytes of data:
15
Request timed out.
16
Request timed out.
17
Request timed out.
18
Request timed out.
19

20
Ping statistics for 94.245.115.230:
21
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
22
11:58
23

24
Pinging google.de [173.194.116.191] with 32 bytes of data:
25
Reply from 173.194.116.191: bytes=32 time=47ms TTL=56
26
Reply from 173.194.116.191: bytes=32 time=46ms TTL=56
27
Reply from 173.194.116.191: bytes=32 time=49ms TTL=56
28
Reply from 173.194.116.191: bytes=32 time=46ms TTL=56
29

30
Ping statistics for 173.194.116.191:
31
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
32
Approximate round trip times in milli-seconds:
33
    Minimum = 46ms, Maximum = 49ms, Average = 47ms
34

35
Pinging msn.de [94.245.115.230] with 32 bytes of data:
36
Request timed out.
37
Request timed out.
Gast #3737795
Lesenswert?

sunshineh schrieb:
> "sleep is not recognized as an internal or external command, operable
> program or batch file."

ist ja klar, sleep gibt es nicht. Das musst du erst irgendwo downloaden.

dann könntest du auch gleich ein grep downloaden, dann kannst du die 
Statik wegfiltern.

Das die Zeit nicht auf einer extra Zeile steht kommt daher das kein 
Enter am ende geschrieben wird. Dafür kann man ein Echo "" >> Datei 
machen.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren