brett said:
I have this in a BAT file:
ping 192.168.2.1
ping yahoo.com
PAUSE
When I execute the file, I constantly see "ping 192.168.2.1" in the
command window. It keeps looping on that command. The PAUSE or PING
output never runs. All I want to do is ping the first address, display
the output then ping the second address and display the output. I'd
like the command window to stay open so I can see results from both
pings. Why doesn't the above work and how do I make it work?
Something else is in the .bat file that you are not telling us about, or
maybe you are using a ping program other than the one that comes in Windows.
I wrote the following .bat file:
ping 192.168.2.1
ping yahoo.com
pause
and got the following output:
C:\TEMP
Pinging 192.168.2.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
C:\TEMP
Pinging yahoo.com [66.94.234.13] with 32 bytes of data:
Reply from 66.94.234.13: bytes=32 time=111ms TTL=50
Reply from 66.94.234.13: bytes=32 time=93ms TTL=50
Reply from 66.94.234.13: bytes=32 time=91ms TTL=50
Reply from 66.94.234.13: bytes=32 time=93ms TTL=50
Ping statistics for 66.94.234.13:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 91ms, Maximum = 111ms, Average = 97ms
C:\TEMP
Press any key to continue . . .
I didn't see a problem with the commands you listed in the .bat file, and
they work okay for me. You didn't clearly explain what you meant by
"looping" on that [the first] ping command. Was the ping command
reexecuting, or were you getting repeated output from it? I got the
repeated timeout because there is no such host in my intranetwork with that
IP address. If I replace it with a valid IP address, the timeouts change to
the "Reply from" output (as was shown for the ping to yahoo.com).
Are you perchance running Microsoft's AntiSpyware program? If so, what
happens when you disable it?