python禁用本地网卡_无线网络连接与本地连接的网卡禁用启用切换 能不能让无线网卡自动连接信号源呀?...

********以下是"Run-WirelessConnection.vbs"的代码(我只是分割线 不包括我)********

sEnableConnectionName = "无线网络连接"

sDisableConnectionName = "本地连接"

Const ssfCONTROLS = 3

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   = "网络连接" 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(sDisableConnectionName) then

set oLanConnection = folderitem: exit for

end if

next

if oLanConnection is nothing then

msgbox "未找到 '" & sDisableConnectionName & "' item"

Else

Set oEnableVerb = nothing

set oDisableVerb = nothing

For each verb in oLanConnection.verbs

if verb.name = sDisableVerb then

set oDisableVerb = verb

Exit For

end if

next

If not (oDisableVerb is nothing) then

oDisableVerb.DoIt

end if

end If

'---------------------------启用连接---------------------------------

set oLanConnection = nothing

for each folderitem in oNetConnections.items

if lcase(folderitem.name)   = lcase(sEnableConnectionName) then

set oLanConnection = folderitem: exit for

end if

next

if oLanConnection is nothing then

msgbox "未找到 '" & sEnableConnectionName & "' item"

Else

Set oEnableVerb = nothing

set oDisableVerb = nothing

For each verb in oLanConnection.verbs

If verb.name = sEnableVerb then

set oEnableVerb = verb

Exit For

End if

next

If not (oEnableVerb is nothing) then

oEnableVerb.DoIt

end if

end If

wscript.sleep 800

********以下是"Run-LocalConnection.vbs"的代码(我只是分割线 不包括我)********

sEnableConnectionName = "本地连接"

sDisableConnectionName = "无线网络连接"

Const ssfCONTROLS = 3

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   = "网络连接" 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(sDisableConnectionName) then

set oLanConnection = folderitem: exit for

end if

next

if oLanConnection is nothing then

msgbox "未找到 '" & sDisableConnectionName & "' item"

Else

Set oEnableVerb = nothing

set oDisableVerb = nothing

For each verb in oLanConnection.verbs

if verb.name = sDisableVerb then

set oDisableVerb = verb

Exit For

end if

next

If not (oDisableVerb is nothing) then

oDisableVerb.DoIt

end if

end If

'---------------------------启用连接---------------------------------

set oLanConnection = nothing

for each folderitem in oNetConnections.items

if lcase(folderitem.name)   = lcase(sEnableConnectionName) then

set oLanConnection = folderitem: exit for

end if

next

if oLanConnection is nothing then

msgbox "未找到 '" & sEnableConnectionName & "' item"

Else

Set oEnableVerb = nothing

set oDisableVerb = nothing

For each verb in oLanConnection.verbs

If verb.name = sEnableVerb then

set oEnableVerb = verb

Exit For

End if

next

If not (oEnableVerb is nothing) then

oEnableVerb.DoIt

end if

end If

wscript.sleep 800

********以下是"启用 Wireless.bat"的代码(我只是分割线 不包括我)********

@echo off

rem ***************Wireless Zero Configuration

@echo.

sc config WZCSVC start= demand

@echo.

sc start "WZCSVC"

rem ***************Atheros 配置服务

@echo.

sc config ACS start= demand

@echo.

sc start "ACS"

start Run-WirelessConnection.vbs

********以下是"启用 本地连接.bat"的代码(我只是分割线 不包括我)********

@echo off

start Run-LocalConnection.vbs

rem ***************Wireless Zero Configuration

@echo.

sc config WZCSVC start= disabled

@echo.

sc stop "WZCSVC"

rem ***************Atheros 配置服务

@echo.

sc config ACS start= disabled

@echo.

sc stop "ACS"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值