Computing.Net > Forums > Windows 2000 > ERRORLEVEL not produced by ping

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

ERRORLEVEL not produced by ping

Reply to Message Icon

Name: Bruce__Jackson
Date: February 9, 2005 at 08:10:44 Pacific
OS: WIN2000
CPU/Ram: PENT?
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: February 10, 2005 at 03:38:41 Pacific
Reply:

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


0

Response Number 2
Name: jwbanta
Date: March 20, 2005 at 11:17:27 Pacific
Reply:

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
:End

Thanks in advance - jw

jwbanta


0

Response Number 3
Name: kusumalie
Date: March 30, 2005 at 05:03:49 Pacific
Reply:

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
======


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: ERRORLEVEL not produced by ping

LAN collapses when turning on a PC www.computing.net/answers/windows-2000/lan-collapses-when-turning-on-a-pc/55341.html

Ping Entire Network with a command www.computing.net/answers/windows-2000/ping-entire-network-with-a-command/24440.html

Network Path Not Found-Win2000 Pro www.computing.net/answers/windows-2000/network-path-not-foundwin2000-pro/64619.html