管理網(wǎng)卡vbs腳本
更新時(shí)間: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ò)和撥號(hào)連接" 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ò)和撥號(hào)連接" 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)文章
VBS基礎(chǔ)篇 - FileSystemObject對(duì)象詳解
文件系統(tǒng)是所有操作系統(tǒng)最重要的部分之一,腳本經(jīng)常會(huì)需要對(duì)文件及文件夾進(jìn)行訪問和管理,在Vbs中對(duì)桌面和文件系統(tǒng)進(jìn)行訪問的頂級(jí)對(duì)象是FileSystemObject,需要的朋友可以參考下2018-05-05
使用xcacls.vbs(cacls.exe)修改NTFS權(quán)限說明(中文版)
本分步指南介紹如何使用擴(kuò)展的更改訪問控制列表工具 (cacls.exe,對(duì)應(yīng)的腳本文件是xcacls.vbs) 修改和查看文件或文件夾的 NTFS 權(quán)限。2010-08-08
利用VBS發(fā)送短信的實(shí)現(xiàn)代碼(通過飛信)
無意中看到百度 VBS 貼吧里一個(gè)標(biāo)題為《無私的奉獻(xiàn)出我的用飛信免費(fèi)發(fā)短信接口》的帖子。2011-08-08
VBS教程:函數(shù)-數(shù)學(xué)函數(shù)
VBS教程:函數(shù)-數(shù)學(xué)函數(shù)...2006-11-11
VBS調(diào)用Photoshop批量生成縮略圖的代碼
這篇文章主要為大家分享了通過vbs調(diào)用Photoshop批量生成縮略圖,需要的朋友可以參考下2013-12-12

