Re: How to parse output from a command
- From: "Ed Thurber" <no.email@xxxxxxxxxxx>
- Date: Mon, 11 Jul 2005 15:38:19 -0400
Try this
Function Ping_Host(Target)
Dim oExec, CommandLine
CommandLine = "Ping -n 1 -w 100 " & Target
Set oExec = objShell.Exec(CommandLine)
'## Examine output of exec command line by line (kill loop when no more
input)
Do Until oExec.StdOut.AtEndOfStream
Input = oExec.StdOut.ReadLine
' '## If host replies, set ping_host to 1 then Exit
if InStr(Input, "Reply") And not Instr(input, "unreachable") Then
Ping_Host = True
Exit Function
End If
Loop
Ping_Host = FALSE
End Function
"Don" <Don@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4EFA5A17-EB52-4DD7-ABA4-CEA1F6477505@xxxxxxxxxxxxxxxx
>I realize this is more of a windows shell scripting questions, but this new
> menu thing... well, it sucks quite frankly.
>
> Anyway, how would I get the same results out of VBScript, that I would
> from
> this DOS batch command?
>
> for /f "tokens=3 delims=: " %i in ('ping -n 1 localhost ^| find "Reply
> from"') do @echo %i
>
.
- Follow-Ups:
- Re: How to parse output from a command
- From: Don
- Re: How to parse output from a command
- References:
- How to parse output from a command
- From: Don
- How to parse output from a command
- Prev by Date: Re: SMTP delivery options.
- Next by Date: Changing SMTP port in IIS5
- Previous by thread: How to parse output from a command
- Next by thread: Re: How to parse output from a command
- Index(es):
Relevant Pages
|
Loading