硬广 :
提供ahk, python 自动化脚本服务:
我的qq: 513278236
微信: happy_lizhe
我的淘宝店: AHK, python 自动化操作
AHK 获取当前网卡的名字
Mark := false
AdapterName := ""
CMD := "netsh interface ipv4 show config > test.txt"
EXEDosCommand(CMD)
Loop
{
FileReadLine, line, test.txt, %A_Index%
if ErrorLevel
break
FoundPos := RegExMatch(line, "^接口", output)
if(FoundPos)
{
FoundPos := RegExMatch(line, """(.*)""", AdapterName)
Mark := true
continue
}
FoundPos := RegExMatch(line, "192.168.0.[0-9]+")
if(FoundPos)
{
Mark := true
break
}
else
{
continue
}
}
MsgBox 当前使用的网卡名字%AdapterName1%
EXEDosCommand(CMD)
{
filename := A_Now . ".bat"
FileAppend, %CMD%, temp.bat
RunWait, %filename%,, HIDE
FileDelete, %filename%
Sleep,5000
Return
}
网友评论