LanIp := ComObjGet("winmgmts:").ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True").ItemIndex(0).IPaddress[0]
MsgBox % LanIP


MsgBox % "自带命令是逆序排序:`n" A_IPAddress1 "`n" A_IPAddress2 "`n" A_IPAddress3 "`n" A_IPAddress4

/*
; 遍历所有网卡的写法:https://www.autohotkey.com/boards/viewtopic.php?f=6&t=117296
For _ in ComObjCreate("WbemScripting.SWbemLocator").ConnectServer(".", "root\cimv2").ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True") {
  For LanIP in _.IPAddress
    Break
  Break
}
*/

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。