今天论坛一午饭要做一个脚本,我看了下,反正正在学AU3,就顺手查查资料,
找到了下面的方法
代码如下:
TCPStartup()
$ip=TcpNameToIp("www.google.com")
$file = FileOpen("d:\gsnetdog.ini", 1)
; 检查打开的文件是否可写
If $file = -1 Then
MsgBox(0, "错误", "不能打开文件.")
Exit
EndIf
IniWrite("d:\gsnetdog.ini", "ND_TCPIP", "ND_SERVER_ADDR", $ip)
FileClose($file)
$ip=TcpNameToIp("www.google.com")
$file = FileOpen("d:\gsnetdog.ini", 1)
; 检查打开的文件是否可写
If $file = -1 Then
MsgBox(0, "错误", "不能打开文件.")
Exit
EndIf
IniWrite("d:\gsnetdog.ini", "ND_TCPIP", "ND_SERVER_ADDR", $ip)
FileClose($file)
此代码有2个功能:
1.获取域名IP地址
使用方法 tcpstartup() tcpnametoip("域名")
2.查找INI文件字段,更改设置 inwrite()
转载于:https://blog.51cto.com/onepeople/353029