cmd command

Iamnotageek

Expert Member
Joined
Dec 22, 2013
Messages
1,516
#1
Hey guys,

Hope this is in the correct category.

What I want:

I want to run the command "ping 8.8.8.8 -t" and when I hit Ctrl-C I want it to write the data to a .txt file. ( So if I let it run for let's say 10 minutes, I want all that ping data in those 10 minutes copied to a .txt file when I quit the command ).

I've tried the following command:

Code:
ping 8.8.8.8 -t > pinginfo.txt
However it just goes to the next line in the command prompt and does nothing.

Can anyone help perhaps?
 

Honey Badger

Honorary Master
Joined
Apr 30, 2010
Messages
17,010
#3
How do you know it does nothing? It doesn't give you any feedback, go look at the location where you specified it should write the file to
 

InusB

Well-Known Member
Joined
Jan 7, 2010
Messages
375
#4
Did you check the file content, your method worked for me.
Perhaps run cmd as Administrator
 

Iamnotageek

Expert Member
Joined
Dec 22, 2013
Messages
1,516
#5
Yea it looks like it does nothing but the file does get created and there is data in it.

Seems like I went full retard on this one.o_O
 

Dairyfarmer

Expert Member
Joined
Apr 17, 2016
Messages
1,896
#6
I use fping (https://fping.org/) . w 1000 = 1 second. Change it to any number of seconds between pings. You can leave out the initial pinging of the router (fping 192.168.10.1). I just do that to ensure the pc is connected to the lan.
Code:
@echo off
Title FPing DNS 8.8.8.8 *** Ctrl+break for Stats ***  Ctrl+C to quit
echo **************************
echo **      Ping Google     **
echo **************************
echo ** Press Ctrl+C to quit **
echo ** Press Ctrl-Break to  **
echo **  get statistics      **
echo **************************
echo ** Ping router to check **
echo ** LAN connection is ok **
echo **************************

fping 192.168.10.1
fping 8.8.8.8 -L c:\FPing\Logs\Pinglog_1_%date:~6,4%%date:~3,2%%date:~0,2%-%time:~0,2%%time:~3,2%%time:~6,2%.txt -D -T -t 1000 -w 10000 -c -r -j
Sample log
Fast pinger version 3.00
(c) Wouter Dhondt (http://www.kwakkelflap.com)

socket() - An attempt was made to access a socket in a way forbidden by its access permissions.

switching to ICMP dll
Pinging 8.8.8.8 with 32 bytes of data every 1000 ms:

2019/01/08 16:36:43.135 : Reply[1] from 8.8.8.8: bytes=32 time=28.2 ms TTL=114
2019/01/08 16:36:44.169 : Reply[2] from 8.8.8.8: bytes=32 time=32.7 ms TTL=114
2019/01/08 16:36:45.195 : Reply[3] from 8.8.8.8: bytes=32 time=26.3 ms TTL=114
2019/01/08 16:36:46.231 : Reply[4] from 8.8.8.8: bytes=32 time=35.2 ms TTL=114
2019/01/08 16:36:47.280 : Reply[5] from 8.8.8.8: bytes=32 time=48.6 ms TTL=114

Ping statistics for 8.8.8.8:
Packets: Sent = 5, Received = 5, Lost = 0 (0% loss)
Approximate round trip times in milli-seconds:
Minimum = 26.3 ms, Maximum = 48.6 ms, Average = 34.2 ms

2019/01/08 16:36:48.325 : Reply[6] from 8.8.8.8: bytes=32 time=43.2 ms TTL=114
2019/01/08 16:36:49.364 : Reply[7] from 8.8.8.8: bytes=32 time=38.5 ms TTL=114
2019/01/08 16:36:50.390 : Reply[8] from 8.8.8.8: bytes=32 time=26.1 ms TTL=114
2019/01/08 16:36:51.433 : Reply[9] from 8.8.8.8: bytes=32 time=42.4 ms TTL=114
2019/01/08 16:36:52.486 : Reply[10] from 8.8.8.8: bytes=32 time=52.8 ms TTL=114
2019/01/08 16:36:53.517 : Reply[11] from 8.8.8.8: bytes=32 time=30.3 ms TTL=114

Ping statistics for 8.8.8.8:
Packets: Sent = 11, Received = 11, Lost = 0 (0% loss)
Approximate round trip times in milli-seconds:
Minimum = 26.1 ms, Maximum = 52.8 ms, Average = 36.7 ms
 
Last edited:
Top