代码如下
#Include <GuiTab.au3>
#include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#RequireAdmin
; AutoIt script to switch between two network configurations
; GUI to select network scheme
Local $hGui = GUICreate("网络切换器--85", 300, 150)
Local $bScheme1 = GUICtrlCreateButton("切换到办公网络", 10, 10, 120, 30)
Local $bScheme2 = GUICtrlCreateButton("切换到政务网络", 10, 50, 120, 30)
GUICtrlCreateLabel("请点击选择网络", 140, 10)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $bScheme1
RunWait(@ComSpec & ' /c netsh interface ip set address name="以太网" static 192.168.2.85 255.255.255.0 192.168.2.1 1' , "", @SW_HIDE)
RunWait(@ComSpec & ' /c netsh interface ip set dns name="以太网" source=static addr=202.102.192.68 register=PRIMARY' , "", @SW_HIDE)
MsgBox(0x0, "Success", "网络成功切换到互联网")
Case $bScheme2
RunWait(@ComSpec & ' /c netsh interface ip set address name="以太网" static 192.168.6.85 255.255.255.0 192.168.6.1 1' , "", @SW_HIDE)
RunWait(@ComSpec & ' /c netsh interface ip set dns name="以太网" source=static addr=202.102.192.68 register=PRIMARY' , "", @SW_HIDE)
MsgBox(0x0, "Success", "网络成功切换到政务网")
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
; Cleanup
GUIClose($hGui)
运行效果:
再用Resource_Hacker软件给exe程序加一个图标
二、具体步骤
1、打开软件,依次点击File>Open,再找到自己想要改变图标的.exe文件。
2.点击想要改变图标的.exe文件,再点击打开。
3、再依次点击Action>Add an Image...
4、再点击Select File,找到想要的图标(图标必须文.ico格式,一般的图片可以在浏览器中搜索ico转换,会有很多的在线转换网站)
5、选中图标后打开,然后再点击Add Resource。
6、最后保存。关闭软件后,生成的带图标的.exe在同一目录下(如下图)。
Warning: Trying to access array offset on value of type bool in /www/wwwroot/1.94.55.152_233/usr/themes/MWordStar/post.php on line 88
评论已关闭