脚本开发教程分享:用按键精灵脚本查询本机 IP 地址
方法/步骤
1
如果想在脚本中查询本机正在上网时的 内网IP 地址,可以使用如下脚本源码:
2
VBSBegin Set obj = GetObject('winmgmts:\\.\root\cimv2') Set IPConfigSet = obj.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) add = IPConfig.IPAddress(i) MessageBox(add) Next End If NextVBSEnd
3
将弹出一个窗口,显示你正在上网的内网 IP 地址。