I have a Windows XP machine on which I would like to ping another machine and send the output to a text file for review at a later date. This is quite a standard question with several answers on this website and others.
The issue I have is that when reviewing the text file afterwards, the output of the ping appears as a strange character. A screenshot of the text file output can be found below.
Here is the code I'm using:
@echo off For /f "tokens=1-2 delims=/:" %%b in ("%TIME%") do (set mytime=%%a%%b) PING 188.8.131.52 -n 1 -w 1000 >NUL for /f "tokens=*" %%A in ('ping 192.168.5.2 -w 10 -n 1') do (echo %date% %time% %%A >> C:\Temp\Ping_Checks\GarrickSide.txt && GOTO Ping ) :Ping PING 184.108.40.206 -n 1 -w 1000 >NUL for /f "tokens=* skip=2" %%A in ('ping 192.168.5.2 -w 10 -n 1') do (echo %date% %time% %%A >> C:\Temp\Ping_Checks\GarrickSide.txt && GOTO Ping )
The code is copied from another source.
As I don’t fully understand it, I didn’t want to remove elements;
that's why I left in the
mytime code that I don’t use.
This code works fine on a Windows 7 machine, but not on a Windows XP machine. It appears that the echo command isn't outputting the right data, but I don't understand this enough to correct it.
Can anyone spot where I'm going wrong?