Re: if command in Do loop
- From: foxidrive <gotcha@xxxxxxxxxxxxxx>
- Date: Wed, 07 Feb 2007 21:34:47 +1100
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)
.
- References:
- if command in Do loop
- From: IT Staff
- if command in Do loop
- Prev by Date: if command in Do loop
- Next by Date: Re: changing PATH with bracket
- Previous by thread: if command in Do loop
- Index(es):
Relevant Pages
|
Loading