FUNCTION Ping(tcIp)
IF EMPTY(tcIp)
RETURN .F.
ENDIF
loShell = CreateObject("WScript.Shell")
IF VARTYPE(loShell)<>'O'
RETURN .F.
ENDIF
loScriptExec = loShell.Exec("ping -n 1 -w 2 -4 "+tcIp)
lcResp = loScriptExec.StdOut.ReadAll()
llRet = [TTL=]$lcResp
loScriptExec = null
loShell = null
RETURN llRet
ENDFUNC
IF EMPTY(tcIp)
RETURN .F.
ENDIF
loShell = CreateObject("WScript.Shell")
IF VARTYPE(loShell)<>'O'
RETURN .F.
ENDIF
loScriptExec = loShell.Exec("ping -n 1 -w 2 -4 "+tcIp)
lcResp = loScriptExec.StdOut.ReadAll()
llRet = [TTL=]$lcResp
loScriptExec = null
loShell = null
RETURN llRet
ENDFUNC
Ejemplo de uso:
ip = "172.16.10.210"
? IP + " - " + TRANSFORM(ping(ip))
No hay comentarios.:
Publicar un comentario