本帖最后由 jycel 于 2009-8-19 23:03 编辑
以下是坛子里找的禁用/启用,还不熟悉vbs和wmi,那位帮我改下,根据网卡名称只禁用或分开来
;AU3版本禁用/启用网卡
; www.autoitx.com 中文论坛版权所有
Global Const $ssfCONTROLS = 3
$sConnectionName = "本地连接"
$sEnableVerb = "启用(&A)"
$sDisableVerb = "停用(&B)" ;2003 应改为“禁用(&B)”
$shellApp = ObjCreate("shell.application")
$oControlPanel = $shellApp.Namespace($ssfCONTROLS)
$oNetConnections = ""
for $folderitem in $oControlPanel.items
if $folderitem.name = "网络连接" then
$oNetConnections = $folderitem.getfolder
ExitLoop
endif
next
if $oNetConnections ="" then
MsgBox(0,"","未找到网络连接文档夹")
Exit
endif
$oLanConnection = ""
for $folderitem in $oNetConnections.items
if StringLower($folderitem.name) = StringLower($sConnectionName) then
$oLanConnection = $folderitem
ExitLoop
endif
next
if $oLanConnection ="" then
Exit
endif
$bEnabled = true
$oEnableVerb = ""
$oDisableVerb = ""
$s = "Verbs: " & @crlf
for $verb in $oLanConnection.verbs
$s = $s & @crlf & $verb.name
if $verb.name = $sEnableVerb then
$oEnableVerb = $verb
$bEnabled = false
endif
if $verb.name = $sDisableVerb then
$oDisableVerb = $verb
endif
next
if $bEnabled then
$oDisableVerb.DoIt
else
$oEnableVerb.DoIt
endif
sleep(1000)
|