来源:按键学院 【按键精灵】 如果想在脚本中查询本机正在上网时的 内网IP 地址,可以使用如下脚本源码:
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 Next VBSEnd
将弹出一个窗口,显示你正在上网的内网 IP 地址。 |
|