Re: if command in Do loop



On Wed, 7 Feb 2007 16:33:35 +0800, "IT Staff" <jkklim@xxxxxxxxxxx> wrote:

For /F %%i In (%filename%) Do Call :Ping4Name %%i

:Ping4Name
For /F "Tokens=2" %%a In ('ping -n 1 %1 ^| find /i "Reply"') Do whatever

i want a "if" statement after the do loop. My aim is to find,

a) during the for loop, if able to find /i reply, do whatever
b) during the for loop, if UNABLE to find /i reply, how can i echo "reply
not found"?


Using find "TTL=" is better than find /i "Reply" as there is a "no reply
from" response from ping.


(set flag=)
For /F "Tokens=2" %%a In ('ping -n 1 %1 ^|find "TTL="') Do set flag=%%a
if defined flag (whatever with %flag%) else (echo reply not found)

.



Relevant Pages

  • Scripting
    ... I have a situation where I want to be able to echo a variable to a flag ... more variables then loop the new ones through. ... incrementation of the SET command. ...
    (microsoft.public.access.forms)
  • Re: Any raw data specs for the Apple IIgs BRAM?
    ... original set of example data with the original assembly code and with ... the AppleScript, and they don't match. ... ' current value of the carry flag and then change the carry flag ... ' end of the loop ...
    (comp.sys.apple2.programmer)
  • Re: semi-timely interrupt
    ... check the flag on every RTS, LOOP, BREAK instruction. ... want to insinuate an interrupt flag check into RTS, LOOP, and BREAK ...
    (comp.programming.threads)
  • Re: Signal-Unsafe Problem
    ... About the sig_atomic_t flag issue, the problems for my program are that ... My program is also busy running other code. ... There's no need to run a busy loop for the flag alone. ... You can either process incoming data right away, ...
    (comp.os.linux.development.apps)
  • Re: Terminating a running Loop in GUI!
    ... I am having a problem in GUI. ... handles.Userdata.abort = false; % set the flag ... getting the handles structure in the loop might not be ...
    (comp.soft-sys.matlab)

Loading