当前位置: 移动技术网 > IT编程>脚本编程>VBScript > 用vbs得到计算机的 IP 地址

用vbs得到计算机的 IP 地址

2017年12月12日  | 移动技术网IT编程  | 我要评论
描述
返回安装在计算机中的每个支持 ip 的网络适配器的 ip 地址。
脚本代码
复制代码 代码如下:

strcomputer = "." 
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2") 
set ipconfigset = objwmiservice.execquery _ 
    ("select ipaddress from win32_networkadapterconfiguration where ipenabled=true") 
for each ipconfig in ipconfigset 
    if not isnull(ipconfig.ipaddress) then  
        for i=lbound(ipconfig.ipaddress) to ubound(ipconfig.ipaddress) 
            wscript.echo ipconfig.ipaddress(i) 
    next 
    end if 
next 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网