管理網(wǎng)卡vbs腳本
更新時間:2008年04月24日 20:13:16 作者:
管理網(wǎng)卡的vbs腳本
'dislan.vbs
'usage: cscript /nologo dislan.vbs
Const ssfCONTROLS = 3
sConnectionName = "本地連接"
sEnableVerb = "啟用(&A)"
sDisableVerb = "禁用(&B)"
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
for each folderitem in oControlPanel.items
if folderitem.name = "網(wǎng)絡(luò)和撥號連接" then
set oNetConnections = folderitem.getfolder: exit for
end if
next
if oNetConnections is nothing then
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 bEnabled then
oDisableVerb.DoIt
else
oEnableVerb.DoIt
end if
wscript.sleep 1000
'usage: cscript /nologo dislan.vbs
Const ssfCONTROLS = 3
sConnectionName = "本地連接"
sEnableVerb = "啟用(&A)"
sDisableVerb = "禁用(&B)"
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
for each folderitem in oControlPanel.items
if folderitem.name = "網(wǎng)絡(luò)和撥號連接" then
set oNetConnections = folderitem.getfolder: exit for
end if
next
if oNetConnections is nothing then
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 bEnabled then
oDisableVerb.DoIt
else
oEnableVerb.DoIt
end if
wscript.sleep 1000
相關(guān)文章
Wscript.Shell 對象詳細(xì)介紹!!特好的東西
Wscript.Shell 對象詳細(xì)介紹??!特好的東西...2006-12-12vbs 調(diào)用中文語音讓你電腦聽你的命令的實現(xiàn)代碼
關(guān)于vbs調(diào)用中文語音讓你電腦聽你的命令的實現(xiàn)代碼,需要的朋友可以參考下。2009-10-10改進(jìn)后的mkw3site.vbs(創(chuàng)建虛擬目錄)
改進(jìn)后的mkw3site.vbs(創(chuàng)建虛擬目錄)...2007-03-03