|
发表于 2010-3-26 12:28:42
|
显示全部楼层
本帖最后由 a62105400 于 2010-3-26 12:32 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\my documents\au3\服务器基本环境设置.kxf
$Form1_1 = GUICreate("test", 633, 447, 192, 124)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("test", 12, 11, 609, 425)
$Button1 = GUICtrlCreateButton("确定", 240, 304, 113, 25)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$IP= _GUICtrlIpAddress_Create($Form1_1, 72, 56, 145, 19)
_GUICtrlIpAddress_Set($IP, "192.168.1.241")
$DNS = _GUICtrlIpAddress_Create($Form1_1, 72, 161, 145, 19)
_GUICtrlIpAddress_Set($DNS, "61.187.191.3")
$DNS2 = _GUICtrlIpAddress_Create($Form1_1, 72, 180, 145, 19)
_GUICtrlIpAddress_Set($DNS2, "202.103.96.68")
$GW = _GUICtrlIpAddress_Create($Form1_1, 72, 124, 145, 19)
_GUICtrlIpAddress_Set($GW, "192.168.1.252")
$Mask = _GUICtrlIpAddress_Create($Form1_1, 72, 91, 145, 19)
_GUICtrlIpAddress_Set($Mask, "255.255.255.0")
$HostName = GUICtrlCreateInput("HostName", 360, 80, 169, 21)
$port = GUICtrlCreateInput("Port", 360, 126, 169, 21)
$Label1 = GUICtrlCreateLabel("IP", 32, 56, 14, 17)
$Label2 = GUICtrlCreateLabel("Mask", 32, 93, 30, 17)
$Label3 = GUICtrlCreateLabel("GW", 32, 125, 23, 17)
$Label4 = GUICtrlCreateLabel("DNS", 32, 165, 27, 17)
$Label5 = GUICtrlCreateLabel("说明:这是一次测试", 76, 376, 425, 17)
$Progress1 = GUICtrlCreateProgress(76, 408, 505, 17)
GUICtrlSetColor(-1, 0x008080)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"",_GUICtrlIpAddress_Get($ip))
$rc=_RunDOS("netsh interface ip set address ""本地连接 3"" static "&_GUICtrlIpAddress_Get($ip)&" "&_GUICtrlIpAddress_Get($Mask)&" "&_GUICtrlIpAddress_Get($GW))
;_RunDOS("netsh interface ip set address name=""本地连接"" gateway="&$GW&" gwmetric=0")
_RunDOS("netsh interface ip set dns name=""本地连接 3"" source=static addr="&_GUICtrlIpAddress_Get($dns))
_RunDOS("netsh interface ip add dns name=""本地连接 3"" "&_GUICtrlIpAddress_Get($dns2))
EndSwitch
WEnd
我有3个网卡 当前是 本地连接 3 (name用 netsh dump查看) |
|