[windows2000] Re: Multiple arguments in a batch

  • From: "Ray at home" <listray@xxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Tue, 10 Sep 2002 00:03:42 -0400

Okay, as long as we're talking batches, can anyone tell me how to exit
out of a for /f loop, or use something other than a for /f?

Here's a piece of my batch:

for /f "Skip=3 Tokens=1" %%i in ('ping -n 1 %1') do (set Response=%%1) &
call :checkResponse %Response%
:checkResponse
REM echo %*>>%LogFile%
if {%Response%} NEQ {Reply} (call wscript.exe pingalrt.vbs %Domain%
%Email%)
goto :EOF


What I want to do is try to ping %1, and if the response is not "Reply
from..." it should launch a vbs script.  It works fine, but after it
tests the first line from the response, it moves on to the next one.
So, if my ping results are:


***********************************************************
Pinging somedomain.com [213.130.63.232] with 32 bytes of data:

Reply from 213.130.63.232: bytes=32 time=99ms TTL=241

Ping statistics for 213.130.63.232:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 99ms, Maximum = 99ms, Average = 99ms
***********************************************************


It's going to test to see if {Reply} NEQ {Reply}, and then it will move
to tne next line, {} NEQ {Reply} and next, {Ping} NEQ {Reply} and so on.
I'd like it to just check the first line and then stop.  I wish there
where an "exit for" command.  Or who knows, maybe there is.

Thanks,

Ray at home


==================================
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: