复制代码
- @shift
- @echo off
- title 承载网络设置
- Echo -------------------------------------------------------------------------------
- Echo 欢迎使用本程序
- Echo -------------------------------------------------------------------------------
- :1
- Echo -------------------------------------------------------------------------------
- Echo a:指定允许还是禁止托管网络。
- Echo b:托管网络的 SSID。
- Echo c:托管网络使用的用户安全密钥及指定用户密钥密钥是永久性的还是临时的。
- Echo d:启动承载网络
- Echo e:停止承载网络
- Echo f:显示驱动信息
- Echo g:查看是否被蹭网
- Echo h:打开控制面板-网络连接
- Echo i:退出
- Echo j:清空屏幕
- Echo k:查看ssid和key
- Echo l:关闭计算机
- Echo m:添加\删除右键菜单的虚拟WIFI的状态
- Echo (空格/其他):退出
- Echo -------------------------------------------------------------------------------
- set m== ""
- set /p m= 请输入您的选择并回车:
- if /I "%m%"=="a" goto 2
- if /I "%m%"=="b" goto 3
- if /I "%m%"=="c" goto 4
- if /I "%m%"=="d" goto 5
- if /I "%m%"=="e" goto 6
- if /I "%m%"=="f" goto 7
- if /I "%m%"=="g" goto 8
- if /I "%m%"=="h" ncpa.cpl
- if /I "%m%"=="i" exit
- if /I "%m%"=="k" goto 9
- if /I "%m%"=="l" goto 10
- if /I "%m%"=="m" goto 11
- if /I "%m%"==" " exit
- if not exit
- Echo -------------------------------------------------------------------------------
- if /I "%m%"=="j" cls
- pause
- :2
- Echo -------------------------------------------------------------------------------
- Echo 允许还是禁止托管网络?
- Echo a:允许
- Echo b:拒绝
- Echo -------------------------------------------------------------------------------
- set n==""
- set /p n= 请输入您的选择并回车:
- Echo -------------------------------------------------------------------------------
- if /I "%n%"=="a" netsh wlan set hostednetwork mode=allow
- if /I "%n%"=="b" netsh wlan set hostednetwork mode=disallow
- pause
- goto 1
- :3
- Echo -------------------------------------------------------------------------------
- set s==""
- set /p o= 请输入您要设置的WiFi名称并回车:
- netsh wlan set hostednetwork ssid="%o%"
- Echo -------------------------------------------------------------------------------
- pause
- Echo -------------------------------------------------------------------------------
- goto 1
- :4
- Echo -------------------------------------------------------------------------------
- set p==""
- set /p p= 请输入您要设置的密码并回车:
- Echo -------------------------------------------------------------------------------
- Echo 密码性质
- Echo a:永久性密码
- Echo b:临时性密码
- Echo -------------------------------------------------------------------------------
- set q==""
- set /p q= 请输入您的选择并回车:
- if /I "%q%"=="a" netsh wlan set hostednetwork key="%p%" keyUsage=persistent
- if /I "%q%"=="b" netsh wlan set hostednetwork key="%p%" keyUsage=temporary
- Echo -------------------------------------------------------------------------------
- pause
- Echo -------------------------------------------------------------------------------
- goto 1
- :5
- Echo -------------------------------------------------------------------------------
- netsh wlan start hostednetwork
- Echo -------------------------------------------------------------------------------
- pause
- Echo -------------------------------------------------------------------------------
- goto 1
- :6
- Echo -------------------------------------------------------------------------------
- netsh wlan stop hostednetwork
- Echo -------------------------------------------------------------------------------
- pause
- Echo -------------------------------------------------------------------------------
- goto 1
- :7
- Echo -------------------------------------------------------------------------------
- netsh wlan show drivers
- Echo -------------------------------------------------------------------------------
- pause
- Echo -------------------------------------------------------------------------------
- goto 1
- :8
- Echo -------------------------------------------------------------------------------
- netsh wlan show hostednetwork
- pause
- goto 1
- :9
- Echo -------------------------------------------------------------------------------
- netsh wlan show hostednetwork setting=security>>ssid.txt
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in (ssid.txt) do (
- set /a m+=1
- if !m!==6 set a=%%a
- )
- netsh wlan show hostednetwork>>key.txt
- setlocal enabledelayedexpansion
- for /f "delims=" %%b in (key.txt) do (
- set /a n+=1
- if !n!==4 set b=%%b
- )
- Echo -------------------------------------------------------------------------------
- Echo %b%
- Echo %a%
- Echo -------------------------------------------------------------------------------
- Echo off
- del ssid.txt
- del key.txt
- pause
- goto 1
- :10
- shutdown /s
- :11
- Echo -------------------------------------------------------------------------------
- reg query hkcr\DesktopBackground\Shell\VirWifi >nul 2>nul && goto DelVirtualWifi || goto CreateVirtualWifi
- Echo -------------------------------------------------------------------------------
- :CreateVirtualWifi
- reg add hkcr\DesktopBackground\Shell\VirWifi /ve /t reg_sz /d "开启虚拟WIFI" /f >nul 2>nul
- reg add hkcr\DesktopBackground\Shell\VirWifi\command /ve /t reg_sz /d "cmd /c reg query hkcr\DesktopBackground\Shell\VirWifi /ve | find """关闭虚拟WIFI""" >nul 2>nul && (netsh wlan stop hostednetwork >nul 2>nul & reg add hkcr\DesktopBackground\Shell\VirWifi /ve /t reg_sz /d """开启虚拟WIFI""" /f >nul 2>nul) || (netsh wlan start hostednetwork >nul 2>nul & reg add hkcr\DesktopBackground\Shell\VirWifi /ve /t reg_sz /d """关闭虚拟WIFI""" /f >nul 2>nul)" /f >nul 2>nul
- schtasks /create /ru system /tn RestVirWIFI /sc onstart /tr "cmd /c reg add hkcr\DesktopBackground\Shell\VirWifi /ve /t reg_sz /d """开启虚拟WIFI""" /f >nul 2>nul" /f >nul 2>nul
- echo 已将开关虚拟WIFI添加到桌面右击菜单中.
- echo 添加计划任务,系统每次开机都重新初始化虚拟WIFI的显示状态。
- Echo -------------------------------------------------------------------------------
- pause >nul
- goto 1
- :DelVirtualWifi
- echo 确定真的要删除虚拟WIFI?按任意键继续删除,放弃请直接关闭窗口。
- pause >nul
- reg delete hkcr\DesktopBackground\Shell\VirWifi /f >nul 2>nul
- schtasks /delete /tn RestVirWIFI /f >nul 2>nul
- echo 删除成功,按任意键退出。
- pause >nul
- goto 1
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |