1

I am trying to figure out an internet issue. Our IT company has created a file that appears to continually ping google. So I opened the log and they are now saying we corrupted the file, however, all I am seeing from this command is a basic ping with extra detail. Can someone let me know what all this line of code does?

ping -t www.google.com |find /v ""|cmd /q /v:on /c "for /l %%a in (0) do (set "data="&set /p "data="&if defined data echo(!time! !data!)" >> C:\windows\Temp\StreamingLog.txt

5
  • 1
    What is the problem they are trying to solve? And why the F store it in C:\windows\temp\ ? That is not a place where a regular user should be able to write.
    – Hennes
    Commented Nov 3, 2015 at 15:42
  • 1
    ping -t www.google.com >> C:\windows\Temp\StreamingLog.txt gives pretty much the same output. I'm not sure what IT are trying to do here ...
    – DavidPostill
    Commented Nov 3, 2015 at 15:49
  • @DavidPostill: Normal ping output does not include timestamps. Timestamps are important. Alternative ping applications such as hrping have this functionality built in though, which would have shrunk this command line down to hrping -t -T www.google.com >> file
    – qasdfdsaq
    Commented Nov 3, 2015 at 16:47
  • Our internet keeps dropping to slow speeds so they are trying to see it drop. But even when they do they say it's not enough to cause issue. We run a streaming service that streams from one location to 2 others and we are losing our buffers and having bad connectivity on regular frequency. Our streaming provider shows no issue on their end and one of our locations is running fine and provided for by a different IT company.
    – Arthur
    Commented Nov 3, 2015 at 17:32
  • It is probably not an issue with latency, probably an issue with bandwidth - so ping MAY see it, but you might need to employ better methods to narrow down your problem, such as using SNMP to monitor bandwidth on the connection. iperf is also very useful if you control both endpoints. MTR is also very handy, as it tests latency at each hop rather than just rtt for the endpoint.
    – MaQleod
    Commented Nov 3, 2015 at 19:54

1 Answer 1

0

all I am seeing from this command is a basic ping with extra detail

That's exactly what the command is supposed to do.

Can someone let me know what all this line of code does?

  • ping -t www.google.com

Pings www.google.com continuously.

  • | find /v |""

Dirty hack to pipe the output line by line

  • cmd /q /v:on /c "

Runs the subsequent command

  • for /l %%a in (0) do (

Loops forever doing the following on each line of ping output

  • set "data="

Clears the variable data

  • &set /p "data="

Sets the variable data to the line of output from ping

  • &if defined data echo(!time! !data!)"

Prints the time followed by the output of ping if it exists.

  • >> C:\windows\Temp\StreamingLog.txt

Appends the output to C:\windows\Temp\StreamingLog.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .