1#
大 中
小 发表于 2007-9-20 16:59 只看该作者
启用禁用网卡.vbs
'this.vbs---disable/enable network interface card
'usage: cscript /nologo this.vbs
sC '"本地连接"
sEnableVerb = "启用(&A)" '"启用(&A)"
sDisableVerb = "禁用(&B)" '"禁用(&B)"
sFolderName = "网络连接" '有的地方是"网络和拨号连接" ,不同机器可能不一样.
Const ssfCONTROLS = 3
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
'open oControlPanel
for each folderitem in oControlPanel.items
if folderitem.name = sFolderName then
set oNetConnections = folderitem.getfolder: exit for
end if
next
if oNetConnections is nothing then
'msgbox("sdf")
wscript.quit
end if
set oLanConnection = nothing
for each folderitem in oNetConnections.items
if lcase(folderitem.name) = lcase(sConnectionName) then
set oLanConnection = folderitem: exit for
end if
next
if oLanConnection is nothing then
wscript.quit
end if
bEnabled = true
set oEnableVerb = nothing
set oDisableVerb = nothing
s = "Verbs: " & vbcrlf
for each verb in oLanConnection.verbs
s = s & vbcrlf & verb.name
if verb.name = sEnableVerb then
set oEnableVerb = verb
bEnabled = false
end if
if verb.name = sDisableVerb then
set oDisableVerb = verb
end if
next
if oDisableVerb is nothing and oEnableVerb is nothing then
wscript.quit
end if
if bEnabled then
oDisableVerb.DoIt
else
oEnableVerb.DoIt
end if
wscript.sleep 1000
好不容易忙完,现在总算有点时间了。不能及时回答大家的问题,还请大家多多包函。
勇于思考,敢于行动,不逃避问题。
业务联系:dvd制作,各种系统、平面广告设计、3D设计,电脑专业维修,网络组建,MTV个人像册、视频处理!
电话:13423195467
|