如何用QTP或者VB语言获取本机IP?
如题,急求....如何用QTP或者VB语言获取本机IP? 首先说下,如果是考虑要获取WINDOWS 系统资源,就要想到WMI,这是操作系统管理的核心,VBS可以通过这个取到系统的资源及使用情况试下:
ComputerName="."
Dim objWMIService,colItems,objItem,objAddress
Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objItem in colItems
For Each objAddress in objItem.IPAddress
If objAddress <> "" then
GetIP = objAddress
Exit Function
End If
Next
Next 看看 录制脚本百度ip,获取ip
页:
[1]