AutoIT 一键更改IP地址
#RequireAdmin
#include <GUIConstantsEx.au3>
Opt("GUICloseOnESC", 0)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)
#Region ### START Koda GUI section ### Form=
GUICreate("IP切换器",500, 260)
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$tab = GUICtrlCreateTab(5, 10, 490, 240)
;办公网络
$BanGong = GUICtrlCreateTabItem("办公")
$BG = GUICtrlCreateButton("办公网络", 20, 50, 75, 40)
;一层教室名称
$yiceng = GUICtrlCreateTabItem("一层")
$js101 = GUICtrlCreateButton("101教室", 20, 50, 75, 40)
$js102 = GUICtrlCreateButton("102教室", 110, 50, 75, 40)
$js103 = GUICtrlCreateButton("103教室", 200, 50, 75, 40)
$js104 = GUICtrlCreateButton("104教室", 290, 50, 75, 40)
$js105 = GUICtrlCreateButton("105教室", 380, 50, 75, 40)
;二层教室名称
$erceng = GUICtrlCreateTabItem("二层")
$js201 = GUICtrlCreateButton("201教室", 20, 50, 75, 40)
$js202 = GUICtrlCreateButton("202教室", 110, 50, 75, 40)
$js203 = GUICtrlCreateButton("203教室", 200, 50, 75, 40)
$js204 = GUICtrlCreateButton("204教室", 290, 50, 75, 40)
$js205 = GUICtrlCreateButton("205教室", 380, 50, 75, 40)
$MenuItem1 = TrayCreateItem("关于")
TrayCreateItem("")
$MenuItem2 = TrayCreateItem("退出工具")
GUISetState(@SW_SHOW)
GUISetState(@SW_SHOW)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = TrayGetMsg() ;右击图标菜单事件
If $msg = $MenuItem2 Then
Exit
EndIf
If $msg = $MenuItem1 Then
MsgBox("", "关于", "火星时代")
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
;办公网络
Case $BG
BanGong()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为办公IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以办公了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
;一层教室
Case $js101
Class101()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为101教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js102
Class102()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为102教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js103
Class103()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为103教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js104
Class104()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为104教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js105
Class105()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为105教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
;二层教室
Case $js201
Class201()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为201教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js202
Class202()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为202教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js203
Class203()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为203教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js204
Class204()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为204教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
Case $js205
Class205()
$tishi = MsgBox(1 + 32, "IP修改成功", "IP地址已经更改为205教室IP!" & @CRLF & "" & @CRLF & "" & @CRLF & "可以开始上课了", 0)
Select
Case $tishi = 1 Or $tishi = -1
Exit
Case $tishi = 2
WinClose("成功")
EndSelect
EndSwitch
WEnd
;办公网络IP地址参数
Func BanGong()
RunWait('netsh interface ip set address name = "本地连接" source = dhcp gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = dhcp register = PRIMARY', "c:\windows\system32", @SW_HIDE)
EndFunc ;==>BanGong
;一层教室IP地址参数
Func Class101()
$IP = "10.1.11.10"
$zwym = "255.255.255.0"
$router = "10.1.11.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
EndFunc ;==>Class101
Func Class102()
$IP = "10.1.12.10"
$zwym = "255.255.255.0"
$router = "10.1.12.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.12.2\",@DesktopDir & "\102教室服务器.lnk")
EndFunc ;==>Class102
Func Class103()
$IP = "10.1.13.10"
$zwym = "255.255.255.0"
$router = "10.1.13.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.13.2\",@DesktopDir & "\103教室服务器.lnk")
EndFunc ;==>Class103
Func Class104()
$IP = "10.1.14.10"
$zwym = "255.255.255.0"
$router = "10.1.14.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.14.2\",@DesktopDir & "\104教室服务器.lnk")
EndFunc ;==>Class104
Func Class105()
$IP = "10.1.15.10"
$zwym = "255.255.255.0"
$router = "10.1.15.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.15.2\",@DesktopDir & "\105教室服务器.lnk")
EndFunc ;==>Class105
;二层教室IP地址参数
Func Class201()
$IP = "10.1.32.10"
$zwym = "255.255.255.0"
$router = "10.1.32.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.32.2\",@DesktopDir & "\201教室服务器.lnk")
EndFunc ;==>Class201
Func Class202()
$IP = "10.1.33.10"
$zwym = "255.255.255.0"
$router = "10.1.33.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.33.2\",@DesktopDir & "\202教室服务器.lnk")
EndFunc ;==>Class202
Func Class203()
$IP = "10.1.34.10"
$zwym = "255.255.255.0"
$router = "10.1.34.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.34.2\",@DesktopDir & "\203教室服务器.lnk")
EndFunc ;==>Class203
Func Class204()
$IP = "10.1.35.10"
$zwym = "255.255.255.0"
$router = "10.1.35.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.35.2\",@DesktopDir & "\204教室服务器.lnk")
EndFunc ;==>Class204
Func Class205()
$IP = "10.1.36.10"
$zwym = "255.255.255.0"
$router = "10.1.36.254"
$dns = "10.2.1.91"
$bak_dns = "10.2.1.90"
RunWait('netsh interface ip set address name = "本地连接" source = static addr = ' & $IP & ' mask = ' & $zwym & ' gateway = ' & $router & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip set dns name = "本地连接" source = static addr = ' & $dns & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
RunWait('netsh interface ip add dns name = "本地连接" addr = ' & $bak_dns & ' index=2', "c:\windows\system32", @SW_HIDE)
FileDelete(@DesktopDir & "\*教室服务器.lnk")
FileCreateShortcut("\\10.1.36.2\",@DesktopDir & "\205教室服务器.lnk")
EndFunc ;==>Class205
转载于:https://blog.51cto.com/itxwh/1265846
AutoIT 一键更改IP地址相关推荐
- 如何在命令行下更改ip地址
微软的Windows家族从Windows NT开始跨入了网络操作系统的市场,到现在的Windows 2003可以说网络功能在逐渐的完善,在这个成长过程中Windows融入了很多其他网络操作系统的功能, ...
- 组策略妙用----通过组策略禁止域用户更改IP地址
禁止更改IP地址 如果允许用户能够自己更改IP地址,就有可能和网络中其他计算机IP地址冲突.有些单位的网络管理员配置好计算机的IP地址后,不想让用户自己更改.以下示例将会演示禁止用户更改IP地址一种方 ...
- 用Python更改IP地址(转)
用Python更改IP地址(转) 大多数用笔记本电脑的朋友都有一个烦恼,那就是在家里和公司的IP地址不一样,上班和回家后都得来回切换IP地址,两个字"麻烦".最近在写Python, ...
- cmder上传文件到服务器,wget 结合everything上传文件到服务器端(以及更改ip地址)...
上传服务器的方式有很多,平时常用的是ssh,scp等一些命令操作,但是当文件足够大的时候,用这些命令就显得力不从心了. 下面推荐一种操作系统是win10环境下上传批量文件到服务端的方法. 需要用到的软 ...
- 软件测试工作怎样修改本机IP,如何在命令行下更改IP地址
如何在命令行下更改IP地址 发表于:2007-07-02来源:作者:点击数: 标签: 微软的Windows家族从Windows NT开始跨入了 网络 操作系统的市场,到现在的Windows 2000可 ...
- C++不重起Windows直接更改IP地址
出处:http://www.cppblog.com/lizao2/archive/2012/10/11/193147.aspx 源代码运行效果图如下: 设置IP地址只需要更改注册表中关于适配器的相应设 ...
- 修改sep客户端服务器地址,SEP服务更改IP地址操作手册
<SEP服务更改IP地址操作手册>由会员分享,可在线阅读,更多相关<SEP服务更改IP地址操作手册(6页珍藏版)>请在人人文库网上搜索. 1.SEP服务器更换IP地址操作手册1 ...
- win10更改IP地址遇错(出现了一个意外情况,不能完成你的更改)
最近买的新电脑是win10系统,因为之前一直用的win7特别顺手,导致现在用win10真的是各种不便. 今天想通过windows的图形界面修改本机的IP地址,但点击确定却莫名报错: 出现了一个意外情况 ...
- 如何更改IP地址使用代理ip软件
如果您想更改家用计算机上的 IP 地址,有几种方法可能适合您--有些简单,有些则不然.在尝试下面描述的更复杂/技术方法之前,您可以尝试一些非常简单的方法. 只需关闭或拔下调制解调器约五分钟.(您不必关 ...
最新文章
- NLP——基于transformer 的翻译系统
- python画树叶-如何理解python一行代码实现一个爱心字符画?
- AngularJS依赖注入
- 【TensorFlow】tf.nn.softmax_cross_entropy_with_logits中的“logits”到底是个什么意思?
- 【转】 Android 屏幕切换总结
- 对比let、const、var的异同
- 前端入行两年--教会了我这些道理
- angular 模块构建_我如何在Angular 4和Magento上构建人力资源门户
- hibernate update sql
- 已知一个函数f可以等概率的得到1-5间的随机数,问怎么等概率的得到1-7的随机数...
- php 调试 500,利用WordPress开发者调试模式解决PHP500内部服务器错误 | 骤雨打新荷...
- Flash Builder4.7破解方法
- ipad和android同步照片,4种方式将照片从iPhone传输到iPad
- 人类的终极目标是什么?
- RecyclerView吸顶效果
- 荣耀5x android7,华为荣耀畅玩5X/6/7/i7 Bootloader解锁教程
- 基于百度地图API的WinForm地图
- css文字一半居左一半居右
- 上海应用技术大学计算机专业分数线,上海应用技术大学历年分数线 2021上海应用技术大学录取分数线...
- ART虚拟机 | Cleaner机制源码分析