@echo off
title Wifi 热点控制
echo #注意:本文件需以管理员身份运行!#
:Begin
echo ========================
echo 请选择操作:
echo 1 设置 wifi
echo 2 启动 wifi
echo 3 关闭 wifi
echo 0 退出
echo ========================
set /p choice=选择:
if %choice%==1 goto SetWifi
if %choice%==2 goto StartWifi
if %choice%==3 goto StopWifi
if %choice%==0 goto End
:SetWifi
set /p name=输入 wifi 名称:
set /p password=输入 wifi 密码:
netsh wlan set hostednetwork mode=allow ssid=%name% key=%password%
netsh wlan start hostednetwork
echo ###### 请按提示操作完成最后的设置: ######
echo =====================================================================
echo * 打开 [网络和共享中心]-[更改适配器设置]
echo * 在可用的网络连接上 [右键]-[属性]-[共享] 在下拉框中选择虚拟出的网络
echo =====================================================================
echo ###### 操作完成后就可以连接 wifi 了 ######
pause
goto Begin
:StartWifi
netsh wlan start hostednetwork
goto Begin
:StopWifi
netsh wlan stop hostednetwork
goto Begin
:End
pause