Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a script that touches all of the devices on my network using ping - "ping -n 1 xxx.xxx.xxx.xxx > nul" and then echo a report to the screen based on the ERRORLEVEL reported "if ERRORLEVEL 1 echo FAILED."
This BATch file worked fine on an XP workstation, but will not function on an Win2000 workstation.
The Command.com is evaluating correctly as:
if errorlevel 1 echo x
if errorlevel 0 echo y
echo z
echos y and z following a ping failure using Win2000. It is as if the Win2000 ping is not properly generating an ERRORLEVEL. Is there a service pack fix for this?

The one I have works:
07-12-1999 16,144 ping.exe
You're welcome to a copy.
You're not REALLY using command.com, are you?
M2

M2 - I have a similar problem with my script below. I am running it as .bat file from the desktop of a Win2000 server. It is supposed to ping a standard ip address and then using ERRORLEVEL of the ping echo a "good" or "fail" to the user and to a log file. Any suggestions?
REM Pinging the multicast connection
ping -a 192.168.223.1
if ERRORLEVEL 0 goto Passed
if NOT ERRORLEVEL 0 goto Failed
:Failed
echo "Validation Failure. Please verify cable and contact GCS"
echo "Validation Failure. Please verify cable and contact GCS" >> c:\logs\ping.log
sleep 20
goto End
:Passed
echo "Validation good. Installation complete"
echo "Validation good. Installation complete" >> c:\logs\ping.log
sleep 20
goto End
:EndThanks in advance - jw
jwbanta

its true that PING doesn't produce any ERRORLEVEL envvar, instead using its stdout output to examine that the remote machine is responding. The code would like this:
======
ping /n 1 xxx.yyy.zzz.nnn | find "TTL" > nul
if %ERRORLEVEL% 1 echo Disconnected
======

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |