Windows打开或关闭WLAN和以太网的脚本

脚本命令界面

源码

::获取管理员权限
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

::初始化
:Init

::清屏
cls

::提示用户输入
echo 请选择:
echo 1.打开WLAN,打开以太网
echo 2.打开WLAN,关闭以太网
echo 3.关闭WLAN,打开以太网
echo 4.关闭WLAN,关闭以太网
echo 5.查看网络信息
echo 6.退出工具

::换行
echo.

set /p choice=请输入:

if %choice% == 1 goto Step1
if %choice% == 2 goto Step2
if %choice% == 3 goto Step3
if %choice% == 4 goto Step4
if %choice% == 5 goto Step5
if %choice% == 6 goto End
goto Init

::打开WLAN,打开以太网
:Step1
@netsh interface set interface "WLAN" enabled
@netsh interface set interface "以太网" enabled
goto Finished

::打开WLAN,关闭以太网
:Step2
@netsh interface set interface "WLAN" enabled
@netsh interface set interface "以太网" disabled
goto Finished

::关闭WLAN,打开以太网
:Step3
@netsh interface set interface "WLAN" disabled
@netsh interface set interface "以太网" enabled
goto Finished

::关闭WLAN,关闭以太网
:Step4
@netsh interface set interface "WLAN" disabled
@netsh interface set interface "以太网" disabled
goto Finished

::输出网络信息
:Step5
echo 网络信息:
netsh interface show interface
goto Finished

:Finished 
echo 命令执行完成
pause 
goto Init

:End
exit
THE END
分享
二维码
海报
Windows打开或关闭WLAN和以太网的脚本
脚本命令界面 源码 ::获取管理员权限 @echo off %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1……