Set ws=WScript.CreateObject(wscript.shell) Set wmi=GetObject(winmgmts:\\.\root\cimv2) Set list1=wmi.ExecQuery(select * from Win32_NetworkAdapterConfiguration where ipenabled=true) For Each uu In list1 If Not IsNull(uu.ipaddress) Then For Each uu2 In uu.ipaddress ip=uu2 Exit for next End if Next Set list2=wmi.ExecQuery(select * from Win32_PingStatus where address='& ip &') For Each uu3 In list2 If uu3.StatusCode0 Then ws.Run 软件路径 End if Next