使用笔记本建立免费无线热点 Create Free Ad-Hoc NetWork
秒杀各种“xx度WiFi ”,“xx星随身WIFI”
win7操作系统通过测试,xp不能用
另存脚本为Free_AP.bat
@echo off
title JJ Wireless Access-Point Assistant
ver | find " 6." >nul
if not %errorlevel%==0 ver | find " 7." >nul
If not %errorlevel%==0 GOTO ErrNotSupportOS
:menu
SET AP_SSID=%COMPUTERNAME%AP
SET AP_KEY=%username%1470258369
call :test_status
cls
echo.
echo. Free Wifi Access Point
echo. ======================
echo. Ver 1.0, 20150107
echo.
echo. ** 无线 SSID ** : "%AP_SSID%"
echo. ** 密码 Key ** : "%AP_KEY%"
echo. ---------------------------------------------------------------
echo. 菜单Menu
echo.
echo. 1. 启动/停止无线路由 Start/stop service "%AP_STATUS%"
echo. 2. 查看详细信息 Show detail
echo. D. 禁用无线路由 Disable
echo.
echo. Q. 退出Quit
echo.
echo. 请输入菜单号码, 如果不知道要做什么, 输入数字 1 就好 :-)
echo. Please select your menu:
set userselect=
set /P userselect=:^>
if ["%userselect%"]==["1"] call :startstop_svc
if ["%userselect%"]==["2"] call :show_detail
if ["%userselect%"]==["D"] call :disable_ap
if ["%userselect%"]==["d"] call :disable_ap
if ["%userselect%"]==["Q"] goto :quit
if ["%userselect%"]==["q"] goto :quit
echo.
echo.
echo.
goto :menu
:init
call :call_wlan_cmd set hostednetwork mode=allow ssid=%AP_SSID% key=%AP_KEY%
goto :eof
:startstop_svc
echo.
call :test_status
if ["%AP_STATUS%"]==[""] call :init
if ["%AP_STATUS%"]==["Not available"] call :init
netsh wlan show hostednetwork|find "Status :"|find "Not started" >nul
if %errorlevel%==0 (
call :call_wlan_cmd start hostednetwork
) else (
call :call_wlan_cmd stop hostednetwork
)
pause
goto :eof
:test_status
set AP_STATUS=
for /F "tokens=1,2 delims=:" %%s in ( 'netsh wlan show hostednetwork ^| find "Status :"') do set AP_STATUS=%%t
SET AP_STATUS=%AP_STATUS:~1%
goto :eof
:call_wlan_cmd
netsh wlan %*
if not "%errorlevel%" == "0" (
echo. 发生错误 Error Found
echo. 需要一个有管理员权限的帐户登陆系统,且用鼠标右键点“以系统管理员身份”运行
echo. You must run this command from a command prompt with administrator privilege.
echo.
)
goto :eof
:disable_ap
call :call_wlan_cmd set hostednetwork mode=disallow
goto :eof
:show_detail
call :call_wlan_cmd show hostednetwork
pause
goto :eof
:ErrNotSupportOS
echo. Error:
echo. Only Win7 is supported!
echo.
pause
goto :eof
:quit