平台:Windows 7 、8.1
目的:用bat启用禁用网卡
操作:
cls
@ECHO OFF
title 启用或禁用本地连接
CLS
color 0a
GOTO MENU
:MENU
ECHO.
ECHO. ==============启用禁用本地连接==============
ECHO.
ECHO. 1 禁用本地连接a
ECHO. 2 启用本地连接b
ECHO. 3 退 出
ECHO. ==========================================
ECHO.
ECHO.
echo. 请输入选择项目的序号:
set /p ID=
if "%id%"=="1" goto qiyong
if "%id%"=="2" goto jinyong
if "%id%"=="3" exit
PAUSE
:qiyong
echo 禁用本地连接a
netsh interface set interface name="本地连接" admin=DISABLED
goto MENU
:jinyong
echo 启用本地连接b
netsh interface set interface name="本地连接" admin=ENABLED
GOTO MENU
用VBS也可以
‘Code By Coo_boi
‘Cmd operates the Net-Connections
Dim owSh,Operations
cmd="cmd.exe /c netsh interface set interface name=" & Chr(34) & "本地连接" & Chr(34) & " admin="
Operations=InputBox("1.禁用" & vbNewLine & "2.启用","本地连接")
If Operations="" Then WScript.Quit
Set owSh=CreateObject("Wscript.Shell")
If Operations="1" Then
Operations="DISABLE"
ElseIf Operations="2" Then
Operations="ENABLE"
End If
cmd=cmd & Operations
owSh.Run cmd,True
Set owSh=Nothing