如何在开机/关机的同时禁用网络连接

来源:百度知道 编辑:UC知道 时间:2024/05/30 22:49:13
需要在开机/关机的同时禁用网络连接,或者是在开机时使电脑不能连接到网络。
达到和拔网线一样的效果。

有可用答案的给100分,绝不食言

Const ssfCONTROLS = 3
sConnectionName = "本地连接" '可改成需要控制的连接名称,如"无线网络连接"等
sEnableVerb = "启用(&A)"
sDisableVerb = "停用(&B)" 非xp 系统可能 是禁用
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
for each folderitem in oControlPanel.items
if folderitem.name = "网络连接" then
set oNetConnections = folderitem.getfolder: exit for
end if
next
if oNetConnections is nothing then
msgbox "未找到网络连接文件夹"
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
msgbox "未找到 '" & sConnectionName & "' item"
wscript.qui